Perrin Harkins wrote:

> Have you considered using your own global instead? Or PerlSetVar in httpd.conf?


Yeah. Unfortunately that really doesn't work for me. I can get
TEST_MODE that way, but there are other %ENV vars that I need also
(such as HTML_TEMPLATE_ROOT for example). I did manage to get it
working by registering the cleanup like this:

my %renv = %ENV;
my $sub = sub {
my %orig_env = %ENV;
%ENV = %renv; # copy request-time %ENV

&$cleanup_func();

%ENV = %orig_env; # restore %ENV
};
$r->pool->cleanup_register($sub);

So I just cheated and reset the environment before the cleanup function
is called. I realize I shouldn't rely on %ENV under MP2 for thread
safety reasons, but this app is never going to run on anything other
than a prefork MPM and I can live with that .

Regards,
Michael Schout