Fey::DBIManager - Manage a set of DBI handles
version 0.16
my $manager = Fey::DBIManager->new(); $manager->add_source( dsn => 'dbi:Pg:dbname=MyDB' ); my $source = $manager->default_source(); my $source = $manager->source_for_sql($select_sql);
Fey::DBIManager manager a set of Fey::DBIManager::Source objects, each of which in turn represents a single DBI handle.
Fey::DBIManager
DBI
It's main purpose is to provide a single interface to one or more data sources, allowing you to easily define your database connections in one spot.
This class provides the following methods:
Returns a new Fey::DBIManager object.
This method adds a new Fey::DBIManager::Source object to the manager. It can either accept an instantiated Fey::DBIManager::Source object, or a set of parameters needed to create a new source.
Sources are identified by name, and if you try to add one that already exists in the manager, an error will be thrown.
Given a source name, this returns the named source, if it exists in the manager.
Removes the named source, if it exists in the manager.
Returns true if the manager has the named source.
Returns all of the source in the manager.
This method returns the default source for the manager. If the manager has only one source, then this is the default. Otherwise it looks for a source named "default". If no such source exists, or if the manager has no sources at all, then an exception is thrown.
This method accepts a single Fey::SQL object and returns an appropriate source.
Fey::SQL
By default, this method simply returns the default source. It exists to provide a spot for subclasses which want to do something more clever, such as use one source for reads and another for writes.
Please report any bugs or feature requests to bug-fey-dbimanager@rt.cpan.org, or through the web interface at http://rt.cpan.org. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-fey-dbimanager@rt.cpan.org
Dave Rolsky <autarch@urth.org>
This software is Copyright (c) 2011 by Dave Rolsky.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)
To install Fey::DBIManager, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Fey::DBIManager
CPAN shell
perl -MCPAN -e shell install Fey::DBIManager
For more information on module installation, please visit the detailed CPAN module installation guide.