I'm surprised you're even getting a redirect, this doesn't make sense
to me. the MP cleanup handler is supposed to happen after the
request is served / client connection is terminated (docs below)

if you're trying to do a redirect after processing, try a stacked
handler

http://perl.apache.org/docs/2.0/user/handlers/
http.html#PerlCleanupHandler
There is no cleanup Apache phase, it exists only inside mod_perl. It
is used to execute some code immediately after the request has been
served (the client went away) and before the request object is
destroyed.
There are several usages for this use phase. The obvious one is to
run a cleanup code, for example removing temporarily created files.
The less obvious is to use this phase instead of PerlLogHandler if
the logging operation is time consuming. This approach allows to free
the client as soon as the response is sent.




On Dec 13, 2007, at 4:18 PM, Rolf Schaufelberger wrote:

> On Wednesday 12 December 2007 23:44:40 Perrin Harkins wrote:
>> On Dec 12, 2007 2:05 PM, Rolf Schaufelberger wrote:
>>> my $r = $self->{__apache_req__};

>>
>> Yikes, be careful of storing Apache2::RequestRec objects. Terrible
>> things will happen if you try to access one from a previous request.
>>
>>> $r->pool->cleanup_register (\&cleanup, {name=> 'test', cnt=>10});

>>
>> Try $r->push_handlers(PerlCleanupHandler => \&cleanup);
>>
>> - Perrin

>
> tried this, same result (redirect takes place after cleanup
> function has
> finished).
>
> --
> Rolf Schaufelberger