X-Git-Url: http://git.shiar.nl/gitweb.cgi/perl/plp/.git/blobdiff_plain/0f5e78a789961923b45cae1a881c655fff9e7283..6fb22c399428a8e7cac088cab5603e75a87016fa:/plp.cgi diff --git a/plp.cgi b/plp.cgi index 6dbcee9..85d8210 100755 --- a/plp.cgi +++ b/plp.cgi @@ -2,7 +2,7 @@ use v5.6.0; use PLP; -die 'Wrong module version' if $PLP::VERSION ne '3.00'; +die 'Wrong module version' if $PLP::VERSION ne '3.01'; use vars qw($DEBUG); @@ -23,15 +23,14 @@ our $mod_perl = exists $ENV{MOD_PERL}; my $path_info; while (not -f $file) { if (not $file =~ s/(\/+[^\/]*)$//) { - $ENV{REDIRECT_STATUS} = '404'; - print STDERR "PLP: Not found: $file\n"; + print STDERR "PLP: Not found: $ENV{PATH_TRANSLATED} ($ENV{REQUEST_URI})\n"; if ($mod_perl) { Apache->request->uri($ENV{REQUEST_URI}); print STDOUT "Status: 404 Not Found"; Apache::exit(); } else { - print STDOUT "Status: 404 Not Found\n\nNot found: $ENV{REQUEST_URI}"; + PLP::error(undef, 404); exit; } } @@ -45,11 +44,12 @@ our $mod_perl = exists $ENV{MOD_PERL}; } if (not -r $file) { + print STDERR "PLP: Can't read: $ENV{PATH_TRANSLATED} ($ENV{REQUEST_URI})\n"; if (exists $ENV{MOD_PERL}) { print STDOUT "Status: 403 Forbidden"; Apache::exit(); } else { - print STDOUT "Status: 403 Forbidden\n\nForbidden: $ENV{REQUEST_URI}"; + PLP::error(undef, 403); exit; } } @@ -79,13 +79,9 @@ our $mod_perl = exists $ENV{MOD_PERL}; PLP::Functions->import(); eval qq{package PLP::Script; $PLP::code}; } + PLP::error($@, 1) if $@; select STDOUT; undef *{"PLP::Script::$_"} for keys %PLP::Script::; PLP::SendHeaders() unless $PLP::sentheaders; - if ($@ && $DEBUG & 1){ - print $header{'Content-Type'} =~ m!^text/html!i - ? ("
Debug
", Entity($@)) - : ("[Debug]\n", $@); - } }