git.shiar.nl
/
perl
/
plp
/
.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
3565bec
)
v3.04 release
author
Juerd Waalboer
<juerd@cpan.org>
Thu, 11 Apr 2002 11:18:13 +0000
(11:18 +0000)
committer
Mischa POSLAWSKY
<perl@shiar.org>
Tue, 18 Mar 2008 08:26:09 +0000
(08:26 +0000)
PLP.pm
patch
|
blob
|
history
plp.cgi
patch
|
blob
|
history
diff --git
a/PLP.pm
b/PLP.pm
index ad4a227883f34ce1f863fa74baa5a22be5b31bd0..52fba51c64b72c8b472fb854a1754fe35aa1f6c2 100644
(file)
--- a/
PLP.pm
+++ b/
PLP.pm
@@
-2,7
+2,7
@@
package PLP;
# Not to be used without the CGI script;
# Not to be used without the CGI script;
-our $VERSION = '3.0
3
';
+our $VERSION = '3.0
4
';
use PLP::Functions ();
use PLP::Fields;
use PLP::Functions ();
use PLP::Fields;
@@
-101,10
+101,11
@@
sub source {
sub error {
my ($error, $type) = @_;
if (not defined $type or $type < 100) {
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;
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) = @{ +{
} else {
select STDOUT;
my ($short, $long) = @{ +{
@@
-118,6
+119,12
@@
sub error {
}
}
}
}
+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};
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);
chdir $dir;
$PLP::code = PLP::source($file, 0);
+
tie *PLPOUT, 'PLP::Tie::Print';
select PLPOUT;
tie *PLPOUT, 'PLP::Tie::Print';
select PLPOUT;
+ $PLP::ERROR = \&_default_error;
}
1;
}
1;
diff --git
a/plp.cgi
b/plp.cgi
index a3c427b69379a8e4f53a35350623f84c3e9113b1..e9961f6511ef4d7669b3abce5b77a3967ce048c4 100755
(executable)
--- a/
plp.cgi
+++ b/
plp.cgi
@@
-1,22
+1,19
@@
#!/usr/local/bin/perl
use v5.6.0;
use PLP;
#!/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::code = '';
$PLP::sentheaders = 0;
$PLP::inA = 0;
$PLP::inB = 0;
+ $PLP::DEBUG = 1;
delete @ENV{ grep /^PLP_/, keys %ENV };
}
delete @ENV{ grep /^PLP_/, keys %ENV };
}
-$DEBUG = 1;
-
PLP::start();
{
PLP::start();
{