Why are my shared variables cleared between PerlChildInitHandler and PerlResponseHandler in mod_perl?

I try to load the configuration file into a hash during mine PerlChildInitHandler, and then access the values ​​from PerlResponseHandler. However, although the process number is the same, it seems that the variables changed during the call child_init()revert to the default values ​​during the call handler().

The main scenario:

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;
+3
source share
2 answers

, PerlPostConfigHandler, , , . , - , PerlChildInitiHandler, , , . , - .

+1

, - , (, $My:: variable = 'lols'). , . , ?

0

Source: https://habr.com/ru/post/1760475/


All Articles