NAME

Storm::Source - Always produces active database handles on request

SYNOPSIS

use Storm::Source;

$source = Storm::Source->new(['DBI:mysql:database:3306', 'user', 'pass']);

$source = Gi::DBISource->new('@file.txt|record');

$dbh = $source->dbh;
 

DESCRIPTION

Storm::Source objects will return an active database handle on request. The handle will be created using connection information stored internally.Connection information can easily be retrieved from formatted ascii files.

METHODS

This class has the following methods

$class->new(\@connect_info)

The values in \@connect_info are passed on to DBI->connect to create a database handler when one is requested.

$class->new('@file.txt|record');

You can also load the @connect_info arguments from a text file. The constructor will recognize anytime it is called with a singular argument starting with the @ character. The format of the file containing the connect arguments is one record per line, record name and connect args separated with a pipe character, and the individual connect arguments separated by tab characters. EX:

record1|DBI:mysql:database:address:3306|username|password
record2|DBI:SQLite:dbname=:memory:

$source->dbh

If the $source object is aware of an active database connection, it will be returned. Otherwise, a new database handler will be created from DBI->connect.

AUTHOR

Jeffrey Ray Hallock, <jeffrey dot hallock at gmail dot com>

COPYRIGHT & LICENSE

Copyright 2010 Jeffrey Ray Hallock, All Rights Reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.