v3.06 release
[perl/plp/.git] / plp.cgi
1 #!/usr/local/bin/perl
2 use v5.6.0;
3 use PLP;
4 use strict;
5
6 die 'Wrong module version' if $PLP::VERSION ne '3.06';
7
8 {
9     @PLP::END = ();
10     $PLP::code = '';
11     $PLP::sentheaders = 0;
12     $PLP::inA = 0;
13     $PLP::inB = 0;
14     $PLP::DEBUG = 1;
15     delete @ENV{ grep /^PLP_/, keys %ENV };
16 }
17
18 PLP::start();
19
20 {
21     no strict;
22     PLP::Fields::doit();
23     {
24         package PLP::Script;
25         *headers = \%header;
26         *cookies = \%cookie;
27         PLP::Functions->import();
28         # No lexicals may exist at this point.
29         eval qq{ package PLP::Script; $PLP::code; };
30         PLP::error($@, 1) if $@ and $@ !~ /\cS\cT\cO\cP/;
31         eval   { package PLP::Script; $_->() for reverse @PLP::END };
32         PLP::error($@, 1) if $@ and $@ !~ /\cS\cT\cO\cP/;
33     }
34     PLP::sendheaders() unless $PLP::sentheaders;
35     select STDOUT;
36     undef *{"PLP::Script::$_"} for keys %PLP::Script::;
37 }
38