You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Ian Mahuron <im...@bro-net.com> on 2000/08/16 22:34:47 UTC

creating db handles externally

I have the following code in several of my mod_perl handlers:

my $dbh = DBI->connect($c{db}{dsn}, $c{db}{user}, $c{db}{pass})
|| die(DBI::errstr);

Is there a way to do something like:

my $dbh = $MyModules::DBH;

instead of putting connect string in *EVERY* script?

to get the database handle?  Someone mentioned doing a ChildInitHandler and using Class::Singleton.. I'm a clueless newbie so I
didn't get too far with this (code snippets anyone?).

TIA

Ian