From: Juerd Waalboer Date: Thu, 11 Apr 2002 11:18:13 +0000 (+0000) Subject: v3.04 release X-Git-Tag: 3.06~2 X-Git-Url: http://git.shiar.net/perl/plp/.git/commitdiff_plain/756d5de12d15296e7689a7c5c7b5e35bd0bccb0e v3.04 release --- diff --git a/PLP.pm b/PLP.pm index ad4a227..52fba51 100644 --- a/PLP.pm +++ b/PLP.pm @@ -2,7 +2,7 @@ package PLP; # Not to be used without the CGI script; -our $VERSION = '3.03'; +our $VERSION = '3.04'; use PLP::Functions (); use PLP::Fields; @@ -101,10 +101,11 @@ sub source { sub error { my ($error, $type) = @_; if (not defined $type or $type < 100) { + return undef unless $PLP::DEBUG & 1; + my $plain = $error; + (my $html = $plain) =~ s/([<&>])/'&#' . ord($1) . ';'/ge; PLP::sendheaders unless $PLP::sentheaders; - $error =~ s/([<&>])/'&#' . ord($1) . ';'/ge; - print qq{
}, - qq{Debug information:
$error
}; + $PLP::ERROR->($plain, $html); } else { select STDOUT; my ($short, $long) = @{ +{ @@ -118,6 +119,12 @@ sub error { } } +sub _default_error { + my ($plain, $html) = @_; + print qq{
}, + qq{Debug information:
$html
}; +} + sub start { my $file = $ENV{PATH_TRANSLATED}; $ENV{PLP_NAME} = $ENV{PATH_INFO}; @@ -166,8 +173,10 @@ sub start { chdir $dir; $PLP::code = PLP::source($file, 0); + tie *PLPOUT, 'PLP::Tie::Print'; select PLPOUT; + $PLP::ERROR = \&_default_error; } 1; diff --git a/plp.cgi b/plp.cgi index a3c427b..e9961f6 100755 --- a/plp.cgi +++ b/plp.cgi @@ -1,22 +1,19 @@ #!/usr/local/bin/perl use v5.6.0; use PLP; +use strict; -die 'Wrong module version' if $PLP::VERSION ne '3.03'; - -use vars qw($DEBUG); +die 'Wrong module version' if $PLP::VERSION ne '3.04'; -use strict; { $PLP::code = ''; $PLP::sentheaders = 0; $PLP::inA = 0; $PLP::inB = 0; + $PLP::DEBUG = 1; delete @ENV{ grep /^PLP_/, keys %ENV }; } -$DEBUG = 1; - PLP::start(); {