line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package PLP; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
32
|
use 5.006; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
47
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
883
|
use PLP::Functions (); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
27
|
|
6
|
1
|
|
|
1
|
|
773
|
use PLP::Fields; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
31
|
|
7
|
1
|
|
|
1
|
|
710
|
use PLP::Tie::Headers; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
53
|
|
8
|
1
|
|
|
1
|
|
1499
|
use PLP::Tie::Delay; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
34
|
|
9
|
1
|
|
|
1
|
|
713
|
use PLP::Tie::Print; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
25
|
|
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
6
|
use File::Basename (); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
17
|
|
12
|
1
|
|
|
1
|
|
5
|
use File::Spec; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
24
|
|
13
|
|
|
|
|
|
|
|
14
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
27
|
|
15
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
1687
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
our $VERSION = '3.23'; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# Subs in this package: |
20
|
|
|
|
|
|
|
# _default_error($plain, $html) Default error handler |
21
|
|
|
|
|
|
|
# clean Reset variables |
22
|
|
|
|
|
|
|
# error($error, $type) Handle errors |
23
|
|
|
|
|
|
|
# everything Do everything: CGI |
24
|
|
|
|
|
|
|
# handler($r) Do everything: mod_perl |
25
|
|
|
|
|
|
|
# sendheaders Send headers |
26
|
|
|
|
|
|
|
# source($path, $level, $linespec) Read and parse .plp files |
27
|
|
|
|
|
|
|
# start Start the initialized PLP script |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# The _init subs do the following: |
30
|
|
|
|
|
|
|
# Set $PLP::code to the initial code |
31
|
|
|
|
|
|
|
# Set $ENV{PLP_*} and make PATH_INFO if needed |
32
|
|
|
|
|
|
|
# Change the CWD |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# This gets referenced as the initial $PLP::ERROR |
35
|
|
|
|
|
|
|
sub _default_error { |
36
|
4
|
|
|
4
|
|
5
|
my ($plain, $html) = @_; |
37
|
4
|
|
|
|
|
26
|
print qq{}, |
38
|
|
|
|
|
|
|
qq{Debug information: $html | }; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
# This cleans up from previous requests, and sets the default $PLP::DEBUG |
42
|
|
|
|
|
|
|
sub clean { |
43
|
19
|
|
|
19
|
0
|
41
|
@PLP::END = (); |
44
|
19
|
|
|
|
|
28
|
$PLP::code = ''; |
45
|
19
|
|
|
|
|
31
|
$PLP::sentheaders = 0; |
46
|
19
|
|
|
|
|
34
|
$PLP::DEBUG = 1; |
47
|
19
|
|
|
|
|
25
|
$PLP::print = ''; |
48
|
19
|
|
|
|
|
227
|
delete @ENV{ grep /^PLP_/, keys %ENV }; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
# Handles errors, uses subref $PLP::ERROR (default: \&_default_error) |
52
|
|
|
|
|
|
|
sub error { |
53
|
7
|
|
|
7
|
0
|
13
|
my ($error, $type) = @_; |
54
|
7
|
100
|
66
|
|
|
45
|
if (not defined $type or $type < 100) { |
55
|
6
|
100
|
|
|
|
15
|
return undef unless $PLP::DEBUG & 1; |
56
|
5
|
|
|
|
|
6
|
my $plain = $error; |
57
|
5
|
|
|
|
|
12
|
(my $html = $plain) =~ s/([<&>])/'' . ord($1) . ';'/ge; |
|
0
|
|
|
|
|
0
|
|
58
|
5
|
100
|
|
|
|
11
|
PLP::sendheaders() unless $PLP::sentheaders; |
59
|
5
|
|
|
|
|
12
|
$PLP::ERROR->($plain, $html); |
60
|
|
|
|
|
|
|
} else { |
61
|
1
|
|
|
|
|
4
|
select STDOUT; |
62
|
1
|
|
|
|
|
11
|
my ($short, $long) = @{ |
63
|
1
|
|
|
|
|
1
|
+{ |
64
|
|
|
|
|
|
|
404 => [ |
65
|
|
|
|
|
|
|
'Not Found', |
66
|
|
|
|
|
|
|
"The requested URL $ENV{REQUEST_URI} was not found " . |
67
|
|
|
|
|
|
|
"on this server." |
68
|
|
|
|
|
|
|
], |
69
|
|
|
|
|
|
|
403 => [ |
70
|
|
|
|
|
|
|
'Forbidden', |
71
|
|
|
|
|
|
|
"You don't have permission to access $ENV{REQUEST_URI} " . |
72
|
|
|
|
|
|
|
"on this server." |
73
|
|
|
|
|
|
|
], |
74
|
|
|
|
|
|
|
}->{$type} |
75
|
|
|
|
|
|
|
}; |
76
|
1
|
|
|
|
|
8
|
print "Status: $type\nContent-Type: text/html\n\n", |
77
|
|
|
|
|
|
|
qq{\n}, |
78
|
|
|
|
|
|
|
"\n$type $short\n\n$short", |
79
|
|
|
|
|
|
|
"\n$long \n \n"; |
80
|
1
|
50
|
|
|
|
4
|
print $ENV{SERVER_SIGNATURE} if $ENV{SERVER_SIGNATURE}; |
81
|
1
|
|
|
|
|
3
|
print " |