FastCGI interface (PLP::CGI extension using FCGI)
[perl/plp/.git] / PLP / CGI.pm
index 56ca4db72eece75fcd434f6ed04211545ee4bc4d..817a5523dd4af806dd829e4750210e61e1f70b05 100644 (file)
@@ -2,7 +2,7 @@ package PLP::CGI;
 
 use strict;
 
-our $VERSION = '1.01';
+our $VERSION = '1.02';
 
 use PLP;
 
@@ -21,7 +21,7 @@ sub init {
                        if (not $path =~ s/(\/+[^\/]*)$//) {
                                printf STDERR "PLP: Not found: $path$path_info ($ENV{REQUEST_URI})\n";
                                PLP::error(undef, 404);
-                               exit;
+                               return;
                        }
                        # move last path element onto PATH_INFO
                        $path_info = $1 . $path_info;
@@ -44,7 +44,7 @@ sub init {
        if (not -r $ENV{PLP_FILENAME}) {
                print STDERR "PLP: Can't read: $ENV{PLP_FILENAME} ($ENV{REQUEST_URI})\n";
                PLP::error(undef, 403);
-               exit;
+               return;
        }
 
        delete @ENV{
@@ -56,6 +56,7 @@ sub init {
        chdir $dir;
 
        $PLP::code = PLP::source($file, 0, undef, $ENV{PLP_FILENAME});
+       return 1;
 }
 
 sub read ($) {
@@ -67,8 +68,7 @@ sub read ($) {
 # This is run by the CGI script. (#!perl \n use PLP::CGI; PLP::CGI::everything;)
 sub everything {
        PLP::clean();
-       init();
-       PLP::start();
+       $_[0]->init() and PLP::start();
 }
 
 1;