in reply to RE (3): passing DBI database handles to subroutines
in thread passing DBI database handles to subroutines

With mod_perl, you are likely best just making $dbh a package var of a "library module", that everything use's Then the "won't stay shared" is avoided.
I have quite a bit of code that does this, basically its just wrappers on all the database calls that automagically connect and stay connected, but only a single connection required for each apache process.
  • Comment on RE: RE (3): passing DBI database handles to subroutines

Replies are listed 'Best First'.
RE (5): passing DBI database handles to subroutines
by tilly (Archbishop) on Aug 10, 2000 at 00:14 UTC
    That depends. In this case my consideration was that I did not want someone thinking that they should access that variable directly, and making the connection logic implicit to needing the database simplified initialization logic.

    Making it impossible to even try to make that mistake makes it less likely that I will. :-)