Clinton Gormley wrote: > Am I missing something here. Can PerlCleanupHandlers be setup at > startup with : > > Apache2::ServerUtil->server->push_handlers(PerlCleanupHandler=>\&cleanup); > > I have successfully got a cleanup handler working using: > > - PerlCleanupHandler My::Package (in the config file), or > - $r->push_handlers(PerlCleanupHandler => \&cleanup) in my > request handler > > But setting it up using Apache2::ServerUtil just don't work.
it ought to work, but it should be setting a per-server cleanup instead of a per-request cleanup. see below. > > Does it always have to be set up using a request object (and thus from > inside a request)? no, but per-request cleanups do require a request object. > Is there no way of setting it up once so that it > happens for every request, other than specifying it in the config file? what you're asking for here is significantly different than what you did in your first bit of code - setting a server cleanup handler will run your subroutine when the server exits, which happens on restarts for example. 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. HTH --Geoff