v3.06 release 3.06
authorJuerd Waalboer <juerd@cpan.org>
Tue, 23 Apr 2002 06:19:52 +0000 (06:19 +0000)
committerMischa POSLAWSKY <perl@shiar.org>
Tue, 18 Mar 2008 08:28:07 +0000 (08:28 +0000)
PLP.pm
PLP/Functions.pm
plp.cgi

diff --git a/PLP.pm b/PLP.pm
index 884a2e43686cf7f6ce9214b2a5c5d8cae8ff46eb..03b5b92a69bd57583e43883b96b4e3ddea6fee2b 100644 (file)
--- 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;
index 080c61559e6b273ec3cfbb76970f75f89f317233..e07caa5846deaa696c96efe2902f26aca5f31108 100644 (file)
@@ -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 854fe69ec53ecdd867e72c5910d30483032c2f35..a16835c06015ca38d38d48d21c2721b851495d26 100755 (executable)
--- 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;
 }