Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: CHECK and INIT under mod_perl

by perrin (Chancellor)
on Dec 12, 2004 at 17:18 UTC ( [id://414242]=note: print w/replies, xml ) Need Help??


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 ...

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://414242]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2024-04-24 18:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found