Hi All,

I've encounted a strange problem with our mod_perl installation. I have
a library for handling DBI stuff, and store the $dbh in a package-level
lexical. The $dbh is not populated until the first time a DBI call is
made - which is during a request and therefore always after Apache
forks. The $dbh is then used by various functions exported into other
modules.

However, in some of these functions, $dbh seems to be out of scope! In
other words, In some functions, the $dbh works fine, while in others, it
says "cannot call method 'selectcol_arrayref' on an undefined value."
Sure enough, it thinks that $dbh is undefined, even though it will show
up defined in other functions called just prior to or after the function
that attempts to call selectcol_arrayref. I have not my'd it within the
scope of the function - it is only declared at the package-level.

Now, I've managed to solve the problem by simply making $dbh a package
variable (use vars '$dbh';). However, the package-level lexical *was*
working on Friday, but would not as of yesterday!

Anyone got any ideas what the heck is happening to the value stored in
$dbh? I can provide more details about the construction of my DBI
library if you think that will help diagnose the problem.

Details: All DBI calls are made in one request, so there's no chance of
some calls being in different forks where $dbh may not yet have been
defined. Also, the DBI library I've written works fine when run from the
shell - it's only in mod_perl that it fails.

The setup: Solaris 2.4 running Apache 1.3.12 & mod_perl 1.24. DBI is
version 1.14 and DBD::Oracle version 1.06.

TIA!

David

Reply via email to