From 4cbac41f4d1bef193cf955c6c854c8a9ed258119 Mon Sep 17 00:00:00 2001 From: Juerd Waalboer Date: Tue, 23 Apr 2002 06:19:52 +0000 Subject: [PATCH] v3.06 release --- PLP.pm | 2 +- PLP/Functions.pm | 17 ++++++++++++++--- plp.cgi | 11 +++++++---- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/PLP.pm b/PLP.pm index 884a2e4..03b5b92 100644 --- a/PLP.pm +++ b/PLP.pm @@ -2,7 +2,7 @@ package PLP; # Not to be used without the CGI script; -our $VERSION = '3.05'; +our $VERSION = '3.06'; use PLP::Functions (); use PLP::Fields; diff --git a/PLP/Functions.pm b/PLP/Functions.pm index 080c615..e07caa5 100644 --- a/PLP/Functions.pm +++ b/PLP/Functions.pm @@ -4,8 +4,8 @@ use base 'Exporter'; use strict; -our @EXPORT = qw/HiddenFields Entity DecodeURI EncodeURI Entity include - AddCookie ReadFile WriteFile AutoURL Counter Include/; +our @EXPORT = qw/HiddenFields Entity DecodeURI EncodeURI Entity include PLP_END + AddCookie ReadFile WriteFile AutoURL Counter Include exit/; sub Include ($) { no strict; @@ -14,13 +14,24 @@ sub Include ($) { $PLP::inB = 0; local $@; eval 'package PLP::Script; ' . PLP::source($PLP::file, 0, join ' ', (caller)[2,1]); - PLP::error($@, 1) if $@; + if ($@) { + PLP::Functions::exit if $@ =~ /\cS\cT\cO\cP/; + PLP::error($@, 1); + } } sub include ($) { goto &Include; } +sub exit (;$) { + die "\cS\cT\cO\cP\n"; +} + +sub PLP_END (&) { + push @PLP::END, shift; +} + sub HiddenFields ($@) { my $hash = shift; my %saves; diff --git a/plp.cgi b/plp.cgi index 854fe69..a16835c 100755 --- a/plp.cgi +++ b/plp.cgi @@ -3,9 +3,10 @@ use v5.6.0; use PLP; use strict; -die 'Wrong module version' if $PLP::VERSION ne '3.05'; +die 'Wrong module version' if $PLP::VERSION ne '3.06'; { + @PLP::END = (); $PLP::code = ''; $PLP::sentheaders = 0; $PLP::inA = 0; @@ -25,11 +26,13 @@ PLP::start(); *cookies = \%cookie; PLP::Functions->import(); # No lexicals may exist at this point. - eval qq{package PLP::Script; $PLP::code}; + eval qq{ package PLP::Script; $PLP::code; }; + PLP::error($@, 1) if $@ and $@ !~ /\cS\cT\cO\cP/; + eval { package PLP::Script; $_->() for reverse @PLP::END }; + PLP::error($@, 1) if $@ and $@ !~ /\cS\cT\cO\cP/; } - PLP::error($@, 1) if $@; + PLP::sendheaders() unless $PLP::sentheaders; select STDOUT; undef *{"PLP::Script::$_"} for keys %PLP::Script::; - PLP::sendheaders() unless $PLP::sentheaders; } -- 2.30.0