# Not to be used without the CGI script;
-our $VERSION = '3.03';
+our $VERSION = '3.04';
use PLP::Functions ();
use PLP::Fields;
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{<table border=1 class="PLPerror"><tr><td>},
- qq{<span><b>Debug information:</b><BR>$error</td></tr></table>};
+ $PLP::ERROR->($plain, $html);
} else {
select STDOUT;
my ($short, $long) = @{ +{
}
}
+sub _default_error {
+ my ($plain, $html) = @_;
+ print qq{<table border=1 class="PLPerror"><tr><td>},
+ qq{<span><b>Debug information:</b><BR>$html</td></tr></table>};
+}
+
sub start {
my $file = $ENV{PATH_TRANSLATED};
$ENV{PLP_NAME} = $ENV{PATH_INFO};
chdir $dir;
$PLP::code = PLP::source($file, 0);
+
tie *PLPOUT, 'PLP::Tie::Print';
select PLPOUT;
+ $PLP::ERROR = \&_default_error;
}
1;
#!/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();
{