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
generalize reading post input
[perl/plp/.git]
/
PLP
/
CGI.pm
diff --git
a/PLP/CGI.pm
b/PLP/CGI.pm
index ee81b37d0d0522001954b377540dc15bc1d595a5..56ca4db72eece75fcd434f6ed04211545ee4bc4d 100644
(file)
--- a/
PLP/CGI.pm
+++ b/
PLP/CGI.pm
@@
-9,6
+9,7
@@
use PLP;
# CGI initializer: opens SCRIPT_FILENAME
sub init {
$PLP::print = 'print';
# CGI initializer: opens SCRIPT_FILENAME
sub init {
$PLP::print = 'print';
+ $PLP::read = \&read;
if (defined $ENV{PATH_TRANSLATED}) {
# SCRIPT_* points to handler script (Apache CGI)
if (defined $ENV{PATH_TRANSLATED}) {
# SCRIPT_* points to handler script (Apache CGI)
@@
-32,6
+33,11
@@
sub init {
$ENV{SCRIPT_FILENAME} = $path;
$ENV{SCRIPT_NAME} = $rel;
}
$ENV{SCRIPT_FILENAME} = $path;
$ENV{SCRIPT_NAME} = $rel;
}
+ elsif (not -f $ENV{SCRIPT_FILENAME}) {
+ print STDERR "PLP: Not found: $ENV{SCRIPT_FILENAME} ($ENV{REQUEST_URI})\n";
+ PLP::error(undef, 404);
+ return;
+ }
$ENV{"PLP_$_"} = $ENV{"SCRIPT_$_"} for qw/NAME FILENAME/;
$ENV{"PLP_$_"} = $ENV{"SCRIPT_$_"} for qw/NAME FILENAME/;
@@
-52,6
+58,12
@@
sub init {
$PLP::code = PLP::source($file, 0, undef, $ENV{PLP_FILENAME});
}
$PLP::code = PLP::source($file, 0, undef, $ENV{PLP_FILENAME});
}
+sub read ($) {
+ my ($bytes) = @_;
+ read *STDIN, my $data, $bytes;
+ return $data;
+}
+
# This is run by the CGI script. (#!perl \n use PLP::CGI; PLP::CGI::everything;)
sub everything {
PLP::clean();
# This is run by the CGI script. (#!perl \n use PLP::CGI; PLP::CGI::everything;)
sub everything {
PLP::clean();