git.shiar.nl
/
perl
/
plp
/
.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
handle request automatically on PLP::CGI import
[perl/plp/.git]
/
PLP
/
CGI.pm
diff --git
a/PLP/CGI.pm
b/PLP/CGI.pm
index 56ca4db72eece75fcd434f6ed04211545ee4bc4d..1f46a3c9852954a25d1fc279da38aa56dbb42b37 100644
(file)
--- a/
PLP/CGI.pm
+++ b/
PLP/CGI.pm
@@
-2,7
+2,7
@@
package PLP::CGI;
use strict;
use strict;
-our $VERSION = '1.0
1
';
+our $VERSION = '1.0
2
';
use PLP;
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);
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;
}
# 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);
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{
}
delete @ENV{
@@
-56,6
+56,7
@@
sub init {
chdir $dir;
$PLP::code = PLP::source($file, 0, undef, $ENV{PLP_FILENAME});
chdir $dir;
$PLP::code = PLP::source($file, 0, undef, $ENV{PLP_FILENAME});
+ return 1;
}
sub read ($) {
}
sub read ($) {
@@
-64,11
+65,14
@@
sub read ($) {
return $data;
}
return $data;
}
-# This is run by the CGI script. (#!perl \n use PLP::CGI; PLP::CGI::everything;)
sub everything {
PLP::clean();
sub everything {
PLP::clean();
- init();
- PLP::start();
+ $_[0]->init() and PLP::start();
+}
+
+# This is run by the CGI script. (#!perl \n use PLP::CGI;)
+sub import {
+ $_[0]->everything();
}
1;
}
1;