perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Clinton Gormley <>
Subject Re: PerlCleanupHandler in modperl 2
Date Sun, 26 Mar 2006 02:37:49 GMT

> it ought to work, but it should be setting a per-server cleanup instead of a
> per-request cleanup.  see below.


> basically cleanups are performed when memory allocated for different parts
> of the server lifecycle is destroyed.  so, httpd allocates memory for the
> server, per-configuration, per-connection, and per-request.  setting up a
> cleanup handler on each will run the handler whenever the memory pool goes
> out of scope.

Ok - this starts to make sense.

What I'm trying to achieve is :
 - a child init handler which turns on caching (so that the process 
   is owned by the right user)
 - a cleanup handler which cleans out the in memory cache at the end 
   of each request

I seem to be having a lot of trouble putting them in the same place...

In the config file :
PerlRequire "/opt/apache/sites/obits/conf/"
 ## This doesn't work : 
PerlChildInitHandler Obits::Dispatcher::activate_cache

<Location / >
    SetHandler perl-script
    PerlResponseHandler Obits::Dispatcher
    ## This does work :
    PerlCleanupHandler Obits::Dispatcher::cleanup_cache

In the startup file:
use Apache2::ServerUtil;
# this works:
   PerlChildInitHandler => \&activate_cache)

But from here, I can't push a cleanup handler that will be called for
every request, can I?

I have it working by using the PerlChildInitHandler in the startup file
and the PerlCleanupHandler in the apache config, but I would prefer to
put both of these into the startup file.

Is it possible? What am I missing?

thanks for your response Geoff


View raw message