in reply to CHECK and INIT under mod_perl

It's pretty unusual to actually need a CHECK or INIT, so this doesn't come up a lot on the mod_perl list, but I would guess that you could replace it with a sub called during a phase like PerlChildInitHandler. You can make your BEGIN block register this handler automatically if $ENV{'MOD_PERL'} is true.

Replies are listed 'Best First'.
Re^2: CHECK and INIT under mod_perl
by dragonchild (Archbishop) on Apr 19, 2005 at 12:58 UTC
    So, if I understand you correctly, you recommend the following:
    package Floober; sub do_at_init { # Does something nifty } INIT { do_at_init(); } BEGIN { if ( $ENV{ 'MOD_PERL' } ) { ##### # What do I put here? ##### } } 1;
      Depending on when you need it to run, you could do something like this:
      Apache->push_handlers("PerlInitHandler", \&do_at_init);
        Is there an authoritative recipe available that would cover both running under MP1 and MP2, as well as a basic test harness? stvn and I have run into this with Class::LazyLoad and I know Ovid and liz have also run into problems with this ...