FAQ
Hello!

At work I have been having some trouble with localizing %ENV. (This
happens in CPAN modules such as Plack::Handler::Apache2 amongst others.)

All seems well during the request itself - i.e. after the "local" goes out
of scope, %ENV is reset correctly. However, on subsequent requests to the
same process, both MOD_PERL and MOD_PERL_API_VERSION are undefined.

We are running Debian wheezy, and have reproduced this from SVN r1600690
built against Debian's Apache.

This happens with "SetHandler perl-script", but not with "SetHandler
modperl".

Here is our minimal location block:

     <Location />
         SetHandler perl-script
         PerlResponseHandler handler
     </Location>

And our minimal handler:

package handler;

use strict;
use warnings;

use Apache2::Const -compile => qw(OK);
use Apache2::RequestRec;

sub handler {
     my $r = shift;

     no warnings 'uninitialized';

     warn "Before:\n";
     warn "MOD_PERL => $ENV{MOD_PERL}\n";
     warn "MOD_PERL_API_VERSION => $ENV{MOD_PERL_API_VERSION}\n";

     {
         local %ENV;
     }

     warn "After:\n";
     warn "MOD_PERL => $ENV{MOD_PERL}\n";
     warn "MOD_PERL_API_VERSION => $ENV{MOD_PERL_API_VERSION}\n\n";

     $r->content_type("text/plain");

     return Apache2::Const::OK;
}

1;

--
Tim Retout <t.retout@cv-library.co.uk>
Development Manager, CV-Library

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupmodperl @
categoriesmodperl, perl
postedJun 5, '14 at 4:31p
activeJun 5, '14 at 4:31p
posts1
users1
websiteperl.apache.org

1 user in discussion

Tim Retout: 1 post

People

Translate

site design / logo © 2018 Grokbase