in reply to How to share DBI connections between objects?

You might want to check out Ima::DBI.

It's a package for OO style handling of database connections and caching at the class level.

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", {});
The connection is automatically made the first time you refer to the handle.
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
    You might want to check out Ima::DBI.

    Rose::DB handles this sort of thing nicely too.