move plp server handlers to respective modules
authorMischa POSLAWSKY <perl@shiar.org>
Wed, 25 Jul 2007 16:21:02 +0000 (18:21 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Wed, 25 Jul 2007 16:21:02 +0000 (18:21 +0200)
Keep compatibility wrappers for handler() and everything().

PLP.pm
PLP/Apache.pm
PLP/CGI.pm

diff --git a/PLP.pm b/PLP.pm
index 2cb68eac81451b97a639a22936980de42d61d3ae..a919cb7078620e09b0f08e43bbdb21d1efb2ecf8 100644 (file)
--- a/PLP.pm
+++ b/PLP.pm
@@ -80,26 +80,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 +265,7 @@ PLP - Perl in HTML pages
 
     <Files *.plp>
         SetHandler perl-script
-        PerlHandler PLP
+        PerlHandler PLP::Apache
         PerlSendHeader On
         PerlSetVar PLPcache On
     </Files>
@@ -293,8 +281,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)
 
index 217546fbe1abae70c64e711694d7722fc4aa97ce..a18ed258de4d03f20b95ddf28a481bf2b7f09f51 100644 (file)
@@ -4,6 +4,9 @@ use strict;
 
 our $VERSION = '1.00';
 
+use PLP;
+require Apache::Constants;
+
 # mod_perl initializer: returns 0 on success, Apache error code on failure
 sub init {
        our $r = shift;
@@ -39,5 +42,17 @@ sub print {
        $PLP::Apache::r->print(@_);
 }
 
+# This is the mod_perl handler.
+sub handler {
+       PLP::clean();
+       if (my $ret = init($_[0])) {
+               return $ret;
+       }
+       #S PLP::start($_[0]);
+       PLP::start();
+       no strict 'subs';
+       return Apache::Constants::OK();
+}
+
 1;
 
index 1e4d7de63b33b433244b48a3bfc0de022c6cc9d6..2e2305993c86a33f44243182ef21e413a957354f 100644 (file)
@@ -4,6 +4,8 @@ use strict;
 
 our $VERSION = '1.00';
 
+use PLP;
+
 # CGI initializer: parses PATH_TRANSLATED
 sub init {
        $PLP::print = 'print';
@@ -41,12 +43,12 @@ sub init {
        $PLP::code = PLP::source($file, 0, undef, $path);
 }
 
-# This is run by the CGI script. (#!perl \n use PLP; PLP::everything;)
-#sub everything {
-#      clean();
-#      cgi_init();
-#      start();
-#}
+# This is run by the CGI script. (#!perl \n use PLP::CGI; PLP::CGI::everything;)
+sub everything {
+       PLP::clean();
+       init();
+       PLP::start();
+}
 
 1;