I don't have specific help for your problem, but I have noticed that
package-scoped lexicals can be somewhat unpredictable under mod_perl.

1) If at startup time (pre-fork) you use a function within a package
to set a lexical variable that is scoped to that package, that
variable may or may not remain visible to other functions within the
package, depending on how the module was loaded:
    a) if the module was loaded via PerlModule in httpd.conf, the
value will remain visible.
    b) if the module was loaded via "use Module" in starup.pl, the
value will disappear.

2) Constant assignments to package-scoped lexicals can disappear when
the module is reloaded (e.g. via Apache::Reload).  For instance:

    my $CONSTANT_NUMBER = 42;

If the module is reloaded, this value can disappear!

Personally, I've given up on package-scoped lexicals entirely, and
moved everything into "use vars".  It's a pain, because you lose the
encapsulation and you have to declare and assign the variables
separately.  But it generally seems much more robust and predictable.


Michael


Reply via email to