in reply to Sharing DBI handler between several modules

Imho, it depends on ability of such modules to act with database simultaneously. If your application is multithreaded or multiprocessed, I advice some connection pool, for instance SQL Relay. But if you are totally sure that only one module is able to do something in the database always, something like following code is enough, of course, if the only one connection is required... Just idea which I used in some projects - modules can do my $dbh = MyDB::getDbh();

package MyDB; use DBI; our $dbh; sub getDbh { if (defined $dbh) { $dbh->ping; } else { DBI->connect(.....); } return $dbh; }