make mod_perl request object a global in PLP::Apache only
authorMischa POSLAWSKY <perl@shiar.org>
Fri, 14 Mar 2008 23:08:38 +0000 (00:08 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Mon, 17 Mar 2008 19:52:26 +0000 (20:52 +0100)
No reason to always create $PLP::r, as it's only used with Apache.

PLP.pm
PLP/Apache.pm

diff --git a/PLP.pm b/PLP.pm
index a919cb7078620e09b0f08e43bbdb21d1efb2ecf8..5899af3b6378c87770bfa946d33204f8b654cd41 100644 (file)
--- 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 };
 }
 
index bc788811252a533e48457aca4529033cc1325b2a..6b28f949f1f0b6fd1b9ff7e6c6bc0313d148d4eb 100644 (file)
@@ -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.