From: Mischa POSLAWSKY Date: Fri, 14 Mar 2008 23:08:38 +0000 (+0100) Subject: make mod_perl request object a global in PLP::Apache only X-Git-Tag: 3.20~24 X-Git-Url: http://git.shiar.nl/perl/plp/.git/commitdiff_plain/52b63e9e0c0e3d3019a2751158f59cae036b6fe4 make mod_perl request object a global in PLP::Apache only No reason to always create $PLP::r, as it's only used with Apache. --- diff --git a/PLP.pm b/PLP.pm index a919cb7..5899af3 100644 --- a/PLP.pm +++ b/PLP.pm @@ -44,7 +44,6 @@ sub clean { $PLP::sentheaders = 0; $PLP::DEBUG = 1; $PLP::print = ''; - $PLP::r = undef; delete @ENV{ grep /^PLP_/, keys %ENV }; } diff --git a/PLP/Apache.pm b/PLP/Apache.pm index bc78881..6b28f94 100644 --- a/PLP/Apache.pm +++ b/PLP/Apache.pm @@ -21,9 +21,11 @@ BEGIN { } } +our $r; + # mod_perl initializer: returns 0 on success, Apache error code on failure sub init { - our $r = shift; + $r = shift; $PLP::print = 'PLP::Apache::print'; $PLP::read = \&read; @@ -60,7 +62,7 @@ sub read ($) { sub print { return unless grep length, @_; PLP::sendheaders() unless $PLP::sentheaders; - $PLP::Apache::r->print(@_); + $r->print(@_); } # This is the mod_perl handler.