1Storm::Source(3) User Contributed Perl Documentation Storm::Source(3)
2
3
4
6 Storm::Source - Always produces active database handles on request
7
9 use Storm::Source;
10
11 $source = Storm::Source->new(['DBI:mysql:database:3306', 'user', 'pass']);
12
13 $source = Storm::Source->new('@file.txt|record');
14
15 $dbh = $source->dbh;
16
18 Storm::Source objects will return an active database handle on request.
19 The handle will be created using connection information stored
20 internally.Connection information can easily be retrieved from
21 formatted ascii files.
22
24 This class has the following methods
25
26 $class->new(\@connect_info)
27 The values in "\@connect_info" are passed on to "DBI->connect" to
28 create a database handler when one is requested.
29
30 $class->new('@file.txt|record');
31 You can also load the @connect_info arguments from a text file. The
32 constructor will recognize anytime it is called with a singular
33 argument starting with the @ character. The format of the file
34 containing the connect arguments is one record per line, record name
35 and connect args separated with a pipe character, and the individual
36 connect arguments separated by tab characters. EX:
37
38 record1|DBI:mysql:database:address:3306|username|password
39 record2|DBI:SQLite:dbname=:memory:
40
41 $source->dbh
42 If the $source object is aware of an active database connection, it
43 will be returned. Otherwise, a new database handler will be created
44 from DBI->connect.
45
47 Jeffrey Ray Hallock, <jeffrey dot hallock at gmail dot com>
48
50 Copyright 2010 Jeffrey Ray Hallock, All Rights Reserved.
51
52 This program is free software; you can redistribute it and/or modify it
53 under the same terms as Perl itself.
54
55
56
57perl v5.36.0 2023-01-20 Storm::Source(3)