make mod_perl request object a global in PLP::Apache only
[perl/plp/.git] / PLP.pm
diff --git a/PLP.pm b/PLP.pm
index 2cb68eac81451b97a639a22936980de42d61d3ae..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 };
 }
 
@@ -80,26 +79,14 @@ sub error {
        }
 }
 
-# This is run by the CGI script. (#!perl \n use PLP; PLP::everything;)
+# Wrap old request handlers.
 sub everything {
        require PLP::CGI;
-       clean();
-       PLP::CGI::init();
-       start();
+       PLP::CGI::everything();
 }
-
-# This is the mod_perl handler.
 sub handler {
        require PLP::Apache;
-       require Apache::Constants;
-       clean();
-       if (my $ret = PLP::Apache::init($_[0])) {
-               return $ret;
-       }
-       #S start($_[0]);
-       start();
-       no strict 'subs';
-       return Apache::Constants::OK();
+       PLP::Apache::handler(@_);
 }
 
 # Sends the headers waiting in %PLP::Script::header
@@ -277,7 +264,7 @@ PLP - Perl in HTML pages
 
     <Files *.plp>
         SetHandler perl-script
-        PerlHandler PLP
+        PerlHandler PLP::Apache
         PerlSendHeader On
         PerlSetVar PLPcache On
     </Files>
@@ -293,8 +280,8 @@ PLP - Perl in HTML pages
 =item * /foo/bar/plp.cgi (local filesystem address)
 
     #!/usr/bin/perl
-    use PLP;
-    PLP::everything();
+    use PLP::CGI;
+    PLP::CGI::everything();
 
 =item * httpd.conf (for CGI setup)