in reply to RE: RE: passing DBI database handles to subroutines
in thread passing DBI database handles to subroutines

Right you are of course.

OTOH another way to guarantee the right behaviour is to put the subroutine in a module. And that module not coincidentally in my case is where the name and password are, making it easy to change the password periodically.

Of course dealing with mod_perl you probably get to curse the "won't stay shared" error much more than I do. :-)

  • Comment on RE (3): passing DBI database handles to subroutines

Replies are listed 'Best First'.
RE: RE (3): passing DBI database handles to subroutines
by Anonymous Monk on Aug 10, 2000 at 00:08 UTC
    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.
      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. :-)