You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Sergey Borodich <bo...@univ.kiev.ua> on 2007/03/05 12:42:15 UTC

run once at apache stop

Hi,

I need some technique what work as
PerlRequire (or PerlPostConfigHandler)
at apache start (it run only once)

but I need similar technique for stop apache
it must run if "apache stop" only once

it need for cleanup shared memory before stop, etc

and also desirably for mp1/mp2 both

prompt something please...

-- 
Sergey Borodich
http://bor.org.ua

Re: run once at apache stop

Posted by Sergey Borodich <bo...@univ.kiev.ua>.
Sergey Borodich пишет:

>> 2) Another way for mp2: create a cleanup handler APR::Pool::cleanup_register 
>> for one of the global pools. Apache2::ServerRec::pool or 
>> Apache2::Process::pool come to mind.
> thanks for way, I try exploring it
> I hope for mp1 something similar good also

thanks again
it is what I need

mp1
http://perl.apache.org/docs/1.0/guide/porting.html#END_blocks
mp2
http://perl.apache.org/docs/2.0/user/porting/compat.html#C__s_E_gt_register_cleanup_

-- 
Sergey Borodich
http://bor.org.ua

Re: run once at apache stop

Posted by Sergey Borodich <bo...@univ.kiev.ua>.
Torsten Foertsch пишет:
> On Monday 05 March 2007 12:42, Sergey Borodich wrote:
>> I need some technique what work as
>> PerlRequire (or PerlPostConfigHandler)
>> at apache start (it run only once)
>>
>> but I need similar technique for stop apache
>> it must run if "apache stop" only once
>>
>> it need for cleanup shared memory before stop, etc
>>
>> and also desirably for mp1/mp2 both
>>
>> prompt something please...

thanks for answer

> 1) Create an object and store it in a global variable. Then use the DESTROY 
> method to do what you want. That is what Perl::AtEndOfScope does.
it run after each child exit :(

> 2) Another way for mp2: create a cleanup handler APR::Pool::cleanup_register 
> for one of the global pools. Apache2::ServerRec::pool or 
> Apache2::Process::pool come to mind.
thanks for way, I try exploring it
I hope for mp1 something similar good also

> 3) And what about a simple END{} block?
it run after each child exit too :(

I try 1,3 before

I put END(DESTROY) in startup.pl and Lib.pm(loaded from startup)
but result it similar - it run after each apache child exit
tested on mp1(apache1) and mp2(apache2.0)

-- 
Sergey Borodich
http://bor.org.ua


Re: run once at apache stop

Posted by Torsten Foertsch <to...@gmx.net>.
On Monday 05 March 2007 12:42, Sergey Borodich wrote:
> I need some technique what work as
> PerlRequire (or PerlPostConfigHandler)
> at apache start (it run only once)
>
> but I need similar technique for stop apache
> it must run if "apache stop" only once
>
> it need for cleanup shared memory before stop, etc
>
> and also desirably for mp1/mp2 both
>
> prompt something please...

1) Create an object and store it in a global variable. Then use the DESTROY 
method to do what you want. That is what Perl::AtEndOfScope does.

2) Another way for mp2: create a cleanup handler APR::Pool::cleanup_register 
for one of the global pools. Apache2::ServerRec::pool or 
Apache2::Process::pool come to mind.

3) And what about a simple END{} block?

Torsten