You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Denis Banovic <de...@ncm.at> on 2003/03/05 16:56:52 UTC

register_cleanup on mod_perl 2.0

Hi!

I've a script that looks like this:

if ($runnung_on_mod_perl) {
	Apache->request->register_cleanup(\&init_globals);
}

Under mod_perl 1.0 works fine with Apache::Registry.

Can someone give me an Example how to make a register_cleanup with mod_perl
2?

Thanks a lot

Denis 

Re: register_cleanup on mod_perl 2.0

Posted by Stas Bekman <st...@stason.org>.
Stas Bekman wrote:
> Denis Banovic wrote:
> 
>> Hi!
>>
>> I've a script that looks like this:
>>
>> if ($runnung_on_mod_perl) {
>>     Apache->request->register_cleanup(\&init_globals);
>> }
>>
>> Under mod_perl 1.0 works fine with Apache::Registry.
>>
>> Can someone give me an Example how to make a register_cleanup with 
>> mod_perl
>> 2?
> 
> 
> A copy-n-paste from Apache/compat.pm:
> 
> sub register_cleanup {
>     shift->pool->cleanup_register(@_);
> }
> 
> if you use Apache::compat, your mp1 code will work under mp2 unmodified.

And it is documented here:
http://perl.apache.org/docs/2.0/user/compat/compat.html#C__r_E_gt_register_cleanup_
http://perl.apache.org/docs/2.0/user/compat/compat.html#C__s_E_gt_register_cleanup_

In the future please refer to the docs first, before asking on the list.



__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: register_cleanup on mod_perl 2.0

Posted by Stas Bekman <st...@stason.org>.
Denis Banovic wrote:
> Hi!
> 
> I've a script that looks like this:
> 
> if ($runnung_on_mod_perl) {
> 	Apache->request->register_cleanup(\&init_globals);
> }
> 
> Under mod_perl 1.0 works fine with Apache::Registry.
> 
> Can someone give me an Example how to make a register_cleanup with mod_perl
> 2?

A copy-n-paste from Apache/compat.pm:

sub register_cleanup {
     shift->pool->cleanup_register(@_);
}

if you use Apache::compat, your mp1 code will work under mp2 unmodified.

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com