in reply to How to share DBI connections between objects?
It's a package for OO style handling of database connections and caching at the class level.
The connection is automatically made the first time you refer to the handle.package My::Collection; use base qw/Ima::DBI/; __PACKAGE__->set_db('foo', "dbi:pg:foo", "user", "pass", {}); __PACKAGE__->set_db('bar', "dbi:pg:bar", "user", "pass", {});
my $foo_dbh = My::Collection->db_foo; my $bar_dbh = My::Collection->db_bar;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to share DBI connections between objects?
by adrianh (Chancellor) on Mar 27, 2007 at 12:08 UTC |