Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^2: CHECK and INIT under mod_perl

by dragonchild (Archbishop)
on Apr 19, 2005 at 12:58 UTC ( [id://449222]=note: print w/replies, xml ) Need Help??


in reply to Re: CHECK and INIT under mod_perl
in thread CHECK and INIT under mod_perl

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;

Replies are listed 'Best First'.
Re^3: CHECK and INIT under mod_perl
by perrin (Chancellor) on Apr 20, 2005 at 15:17 UTC
    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 ...
        To some degree, whether or not this will work for you depends on what you were trying to do with it. I don't remember any discussions about it on the mod_perl list, which I think is largely due to CHECK and INIT being new and rarely used features. It may be worth a search though.

        Making it work for both MP1 and MP2 would require you to check the version because the API is different. See this for the MP2 syntax.

Log In?
Username:
Password:

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

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

    No recent polls found