Java Mailing List Archive

http://www.apache-httpd.com/

Home » modperl.perl »

shared variable between PerlChildInitHandler and PerlResponseHandler

Mark Risher

2010-08-19

Replies: Find Java Web Hosting

Author LoginPost Reply
Hi, all:
I am trying to load a configuration file into a hash during my PerlChildInitHandler and then access the values from PerlResponseHandler. However, even though the process number is the same, it seems that variables changed during the child_init() call revert back to their default values when handler() gets called.

The basic scenario is:

package StartupLog;

# the variable I'm testing
my $sticky = 0;

sub child_init {
    $sticky = 1;
    return 0;
}

sub handler {
    warn __PACKAGE__ . " sticky = $sticky\n";    ### always says "0" but should say "1"
    return 0;
}
1;

I've been tearing my hair out for hours on this one. Is this something intrinsic to mod_perl that I'm overlooking? I can't find any good examples of loading a config during the PerlChildInit, even though that seems like the best time for me to load it.

Thank you for any help,
/m
©2008 apache-httpd.com - Jax Systems, LLC, U.S.A.