| 1 | # Apache::XPP | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # ------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | # $Revision: 1.32 $ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | # $Date: 2002/02/15 05:00:01 $ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | XPP (XPML Page Parser) - An embedded perl language designed to co-exist with HTML | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | package Apache::XPP; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | use Apache::XPP; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | my $xpp = Apache::XPP->new( Apache->request ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | $xpml->run; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | =head1 REQUIRES | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | Apache | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | Apache::Constants | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | File::stat | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | FileHandle | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | HTTP::Request | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | LWP::UserAgent | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 3 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 3 | ▶ | use vars qw( $AUTOLOAD $debug $debuglines ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 3 | ▶ | BEGIN { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 3 | $Apache::XPP::REVISION = (qw$Revision: 1.32 $)[-1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 3 | $Apache::XPP::VERSION = '2.02'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 3 | ▶ | use Apache::XPP::Cache; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 3 | ▶ | use Apache::XPP::PreParse; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 3 | ▶ | if ($INC{ 'Apache.pm' }) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | eval q{ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | use Apache(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | use Apache::Constants qw(:response); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 3 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 3 | ▶ | use File::stat; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 3 | ▶ | use FileHandle; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 3 | ▶ | use HTTP::Request; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 3 | ▶ | use LWP::UserAgent; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | =head1 EXPORTS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | Nothing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | Apache::XPP is an HTML parser which on run time compiles and runs embedded perl code. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | =head1 CLASS VARIABLES | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | =over | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | =item C<$Apache::XPP::main_class> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | XPP sub-classes must set $Apache::XPP::main_class to the name of the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | sub-class. This will allow xinclude/include to work properly. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 3 | $Apache::XPP::main_class = 'Apache::XPP'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | =item C<$debug> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | Activates debugging output. All debugging output is sent to STDERR. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | At present there are only 4 levels of debugging : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 - no debugging (default) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 1 - some debugging | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 2 - verbose debugging | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 3 - adds some Data::Dumper calls | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | =item C<$debuglines> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | Optionally, you can activate the $debuglines, which will cause all | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | debugging output to include the line numbers (in this file) of the debugging. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 3 | $debug = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 3 | $debuglines = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | =head1 METHODS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | =over | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | =item C<handler> ( $r ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | The Apache handler hook. This is the entry point for the Apache module. It | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | takes the Apache request object ($r) as its parameter and builds a new XPP | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | object to handle the request. In order to support the procedural nature | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | of include() and xinclude() a global is defined. If you subclass Apache::XPP | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | replace the value of the global L<"$Apache::XPP::main_class"> with your class name. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | ▶ | sub handler ($$) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
handler: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 0 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | my $r = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | # handle things other than GET or POST gracefully here | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | ▶ | unless ($r->method eq 'GET' || $r->method eq 'POST') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$r->method eq "GET" or $r->method eq "POST"
MC/DC0%0/2
$r->method eq "GET" or $r->method eq "POST"
$r->method eq "GET"
$r->method eq "POST"
Truth table0%0/3
A or B
A= $r->method eq "GET"B= $r->method eq "POST"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | return NOT_IMPLEMENTED(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | # Prevent browser caching | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | $r->no_cache(1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | # Get the file and build a new XPP object | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | ▶ | warn "\nxpp: handler called" . ($debuglines ? '' : "\n") if ($debug); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | my $xpp = $class->new( { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | filename => $r->filename, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | r => $r, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | is_main => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | server_name => $r->get_server_name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | XPMLHeaders => $r->dir_config( 'XPMLHeaders' ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | XPMLFooters => $r->dir_config( 'XPMLFooters' ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | XPPIncludeDir => $r->dir_config( 'XPPIncludeDir' ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | XPPVHostIncludeDir => $r->dir_config( 'XPPVHostIncludeDir' ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | } ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | ▶ | if (ref($xpp)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | $xpp->run; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | ▶ | if ($@) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | warn "Bad things happened. XPP page didn't compile: $@"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | return SERVER_ERROR(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | $r->log_error("[client " . $r->get_remote_host . "] [Apache::XPP] File not accessible: " . $r->filename()); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | return NOT_FOUND(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | return OK(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | } # END method handler | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | =item C<new> ( \%params | $filename ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | Creates a new XPP object. Valid parameter keys are: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | =item * | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | source - A block of xpp code to be parsed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | =item * | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | filename - A filename/url specifying a code block | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | All other parameters will be stashed in the xpp object. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | { # BEGIN private codeblock | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 3 | my %cache; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 5 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=35 SCAR=58.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 5 | my $proto = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 5 | my ($params, $class); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 5 | ▶ | if (ref($proto)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | $class = ref($proto); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | my %params = %{ $proto }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | delete $params{ 'source' }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | delete $params{ 'filename' }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | @params{ keys %{ $params } } = ( values %{ $params } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | $params = \%params; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 5 | $class = $proto; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 5 | my $data = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 5 | ▶ | $params = ref($data) ? \%{ $data } : { filename => $data }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 5 | ▶ | $params->{ 'server_name' } = 'localhost' unless exists($params->{ 'server_name' }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 5 | ▶ | $params->{ 'XPPIncludeDir' } ||= exists($ENV{'XPPIncludeDir'}) ? $ENV{'XPPIncludeDir'} : ($proto->XPPIncludeDir or './'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition40%2/5
$params->{"XPPIncludeDir"} ||= exists $ENV{"XPPIncludeDir"} ? $ENV{"XPPIncludeDir"} : $proto->XPPIncludeDir || "./"
$proto->XPPIncludeDir or "./"
MC/DC0%0/2
$params->{"XPPIncludeDir"} ||= exists $ENV{"XPPIncludeDir"} ? $ENV{"XPPIncludeDir"} : $proto->XPPIncludeDir || "./"
$params->{"XPPIncludeDir"}
exists $ENV{"XPPIncludeDir"} ? $ENV{"XPPIncludeDir"} : $proto->XPPIncludeDir || "./"
MC/DC0%0/1
$proto->XPPIncludeDir or "./"
$proto->XPPIncludeDir
Truth table33%1/3
A ||= B
A= $params->{"XPPIncludeDir"}B= exists $ENV{"XPPIncludeDir"} ? $ENV{"XPPIncludeDir"} : $proto->XPPIncludeDir || "./"
Truth table50%1/2
A
A= $proto->XPPIncludeDir
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 5 | my $specifier; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | # $specifier is the unique hash key to store the XPP object in the %cache. XPP objects representing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | # files will have the specifier "file:$filename", while XPP objects representing XPP source will use | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | # a checksum (uhhh, CRC?) as a unique string in "source:$checksum". Both of these methods should be | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | # the same for another request. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | # There needs to be a way to expunge objects representing XPP source, as the $specifier will change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | # when the source changes. This will strand the cached XPP object in the %cache hash. Maybe source shouldn't | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | # be cached, or maybe XPP should periodically expunge cached source objects... The call to C<runtime> in the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | # run method was an attempt to expire objects in this way (never finished though). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 5 | ▶ | if ($params->{ 'filename' }) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 2 | $specifier = 'file:' . $params->{ 'filename' }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | } elsif ($params->{ 'source' }) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | # for source cache specifiers, use a checksum of the source | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 3 | $specifier = 'source:' . (unpack("%32C*", $params->{ 'source' }) % 65535); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | ▶ | warn "no filename or source specified in xpp object construction" . ($debuglines ? '' : "\n") if ($debug); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 5 | ▶ | if (my $xcache = $cache{ $specifier }) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | ▶ | warn "xpp:\tmodification time: " . scalar( localtime( $proto->mtime( $params->{ 'filename' } ) ) ) . "\n" if ($debug >= 2); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | ▶ | warn "xpp:\tcache compiled at: " . scalar( localtime( $xcache->compiletime ) ) . "\n" if ($debug >= 2); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 0 | ▶ | if ($proto->mtime( $params->{ 'filename' } ) < $xcache->compiletime) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 0 | ▶ | warn "xpp: using cached xpp object" . ($debuglines ? '' : "\n") if ($debug); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | return $xcache; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 0 | ▶ | warn "xpp: expunging expired cached xpp object" . ($debuglines ? '' : "\n") if ($debug); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | delete $cache{ $specifier }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 5 | ▶ | warn "xpp: creating new xpp object" . ($debuglines ? '' : "\n") if ($debug); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 5 | $params->{ 'preparsers' } = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 5 | my $self = bless($params, $class); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | my $source = ( exists $params->{'source'} ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | ? $params->{ 'source' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 5 | ▶ | : $self->load( $params->{'filename'} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 5 | my $r = $self->r(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | ### Below corresponds to bugfix in r() regarding subrequests | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 0 | ▶ | $r->register_cleanup(sub { delete $self->{'r'}; }) if (ref $params->{'r'}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | #We want to be caching these too. So there aren't conflicts, I'm going to use the header: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | #and :footer cache specifier. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 5 | my ($header, $footer) = ('') x 2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | # This code is essentially the same for $header and $footer, so we use a small loop | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 5 | foreach ({XPMLHeaders => \$header}, {XPMLFooters => \$footer}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 10 | my($dirconf, $headorfoot) = %{$_}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 10 | ▶ | my @files = ref($r) ? split( ':', $self->$dirconf() ) : (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 10 | foreach my $filename (@files) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | my ($hfxpp, $hfcache); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 0 | ▶ | if ($hfcache = $cache{ (($dirconf eq 'XPMLHeaders') ? 'header:' : 'footer:') .$filename }) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 0 | ▶ | if ($proto->mtime( $filename ) > $hfcache->compiletime) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 0 | ▶ | warn "xpp: expunging expired cached header object" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | . ($debuglines ? '' : "\n") if ($debug); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 0 | delete $cache{ $hfcache }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 0 | $hfxpp = bless($params, $class); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 0 | $$headorfoot .= $hfxpp->load( $filename ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 0 | ▶ | warn "xpp: using cached header object" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | . ($debuglines ? '' : "\n") if ($debug); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 0 | $$headorfoot .= $hfcache; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 0 | ▶ | warn "xpp: caching new header object" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | . ($debuglines ? '' : "\n") if ($debug); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 0 | $hfxpp = bless($params, $class); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 0 | $$headorfoot .= $hfxpp->load( $filename ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 5 | $source = $header . $source . $footer; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 5 | $self->parse( $self->preparse( $source ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 5 | $self->compiletime( time ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 5 | $cache{ $specifier } = $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | } # END constructor new | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | } # END private codeblock | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | =item C<preparse> ( ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | Pre-Parses the object's code, converting TAGS to text and xpp code. This method passes a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | reference to the xpp source to each preparser returned by the preparse class's C<parses> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | method. (The preparse class is returned by the C<preparseclass> method). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 3 | ▶ | sub preparse { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
preparse: called CC=7 SCAR=22.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 5 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 5 | ▶ | my $class = ref($self) || return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
ref $self || (return undef)
MC/DC0%0/1
ref $self || (return undef)
ref $self
Truth table50%1/2
A
A= ref $self
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 5 | my $source = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 5 | ▶ | warn "xpp: preparsing source" . ($debuglines ? '' : "\n") if ($debug); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 5 | foreach my $pparser (@{ $class->preparseclass->parsers() }) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 40 | ▶ | warn "xpp: \t$pparser" . ($debuglines ? '' : "\n") if ($debug); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 40 | $class->preparseclass->$pparser( \$source ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 5 | return $self->source( $source ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | } # END method preparse | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | =item C<parse> ( ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | Parses the object's xpp source code, populating the object's C<code> attribute | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | with a subroutine reference which when run (with the C<run> method), will result | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | in the printing of the xpp page. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 5 | ▶ | sub parse { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse: called CC=21 SCAR=34.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 5 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 5 | ▶ | my $class = ref($self) || return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
ref $self || (return undef)
MC/DC0%0/1
ref $self || (return undef)
ref $self
Truth table50%1/2
A
A= ref $self
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 5 | my $string = $self->source; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 5 | ▶ | warn "xpp: parsing source" . ($debuglines ? '' : "\n") if ($debug); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 5 | my @codesrc; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 5 | ▶ | if ($debug >= 3) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 0 | eval "use Data::Dumper;"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 0 | local($Data::Dumper::Indent) = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 5 | ▶ | warn "xpp: parsing source:\n<<\n$string\n>>" . ($debuglines ? '' : "\n") if ($debug); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | # The regex in the while() statement below is somewhat complex. It was placed in one line for efficiency, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | # but this is how it came to be: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | # my $re_b = q{<\?(?:xpp)?(=)?((?:(?!<\?|\?>).)*}; # only q{} and not qr{} because there is an imbalanced paren matched in the next line | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | # my $re_e = q{(?:(?!\?>).)*)\?>}; # only q{} and not qr{} because there is an imbalanced paren matched in the previous line | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | # my $double_xpp = qr{${re_b}(?:${re_b}${re_e})?${re_e}}so; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | # my $regex = qr(^((?:(?!<\?).)*)$double_xpp)s; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | # # this was the old xpp parsing regex (which didn't handle embedded tags). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | # while (($string =~ s/^(.*?)\<\?(?:xpp)?(=)?(.*?\s*)\?\>//so) || ($string =~ s/^(.+)$//so)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 5 | ▶ | while (($string =~ s/^((?:(?!<\?).)*)<\?(?:xpp)?(=)?((?:(?!<\?|\?>).)*(?:<\?(?:xpp)?(?:=)?(?:(?!<\?|\?>).)*(?:(?!\?>).)*\?>)?(?:(?!\?>).)*)\?>//so) || ($string =~ s/^(.+)$//so)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$string =~ s/^((?:(?!<\?).)*)<\?(?:xpp)?(=)?((?:(?!<\?|\?>).)*(?:<\?(?:xpp)?(?:=)?(?:(?!<\?|\?>).)*(?:(?!\?>).)*\?>)?(?:(?!\?>).)*)\?>//os or $string =~ s/^(.+)$//os
MC/DC100%2/2
$string =~ s/^((?:(?!<\?).)*)<\?(?:xpp)?(=)?((?:(?!<\?|\?>).)*(?:<\?(?:xpp)?(?:=)?(?:(?!<\?|\?>).)*(?:(?!\?>).)*\?>)?(?:(?!\?>).)*)\?>//os or $string =~ s/^(.+)$//os
$string =~ s/^((?:(?!<\?).)*)<\?(?:xpp)?(=)?((?:(?!<\?|\?>).)*(?:<\?(?:xpp)?(?:=)?(?:(?!<\?|\?>).)*(?:(?!\?>).)*\?>)?(?:(?!\?>).)*)\?>//os
$string =~ s/^(.+)$//os
Truth table100%3/3
A or B
A= $string =~ s/^((?:(?!<\?).)*)<\?(?:xpp)?(=)?((?:(?!<\?|\?>).)*(?:<\?(?:xpp)?(?:=)?(?:(?!<\?|\?>).)*(?:(?!\?>).)*\?>)?(?:(?!\?>).)*)\?>//osB= $string =~ s/^(.+)$//os
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 7 | my $text = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 7 | ▶ | my $print = $2 ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 7 | my $code = $3; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | 7 | ▶ | warn Data::Dumper->Dump([$text,$code], [qw(text code)]) if ($debug >= 3); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 7 | $text =~ s#\\#\\\\#gso; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 7 | $text =~ s#\'#\\\'#gso; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 7 | ▶ | if ($text) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | 7 | ▶ | if ($self->is_main() && !$self->r()->notes('headersaway')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->is_main and not $self->r->notes("headersaway")
MC/DC0%0/2
$self->is_main and not $self->r->notes("headersaway")
$self->is_main
not $self->r->notes("headersaway")
Truth table33%1/3
A and not(B)
A= $self->is_mainB= not $self->r->notes("headersaway")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 0 | push(@codesrc, "\$xpp->r()->send_http_header();\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 0 | $self->r()->notes(headersaway => 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | 7 | my $textsrc = 'print ' . join(qq{ . "\\n"\n\t. }, map { qq{'$_'} } (split(/\n/, $text,-1))) . ";"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | 7 | push(@codesrc, $textsrc); } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 7 | ▶ | if (defined $code) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 6 | ▶ | if ($print) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | 3 | push(@codesrc, qq{print ($code);}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 3 | push(@codesrc, $code); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | 5 | ▶ | my $type = (ref($self->r()) ? $self->r()->content_type() : ''); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 5 | ▶ | my $filename = defined($self->filename()) ? $self->filename() : ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 5 | my $joined = join('', (@codesrc)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | 5 | my $codesrc = qq{ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | package Apache::XPP::Page; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | my \$xpp = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | if (ref(\$xpp->r())) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | \$xpp->r()->content_type( "${type}" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | #line 0 ${filename} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | ${joined} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | 5 | ▶ | warn "xpp: source:\n" . $codesrc . ($debuglines ? '' : "\n") if ($debug >= 2); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | 5 | my $code = eval $codesrc; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | 5 | ▶ | if ($@) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | 0 | warn "*** XPP COMPILE ERROR: $@"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | 5 | return $self->code( $code ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | } # END method parse | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | =item C<run> ( @arguments ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | Runs the XPP code (set by the C<parse> method), passing any arguments supplied to the code. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | This should have the effect of printing the xpp page to STDOUT. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 5 | ▶ | sub run { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
run: called CC=5 SCAR=18.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | 5 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | 5 | ▶ | my $class = ref($self) || return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
ref $self || (return undef)
MC/DC0%0/1
ref $self || (return undef)
ref $self
Truth table50%1/2
A
A= ref $self
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | 5 | ▶ | warn "xpp: running xpp code" . ($debuglines ? '' : "\n") if ($debug); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | 5 | ▶ | if (ref($self->code)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | # just testing... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 5 | $self->runtime( time ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 5 | $self->code->( $self, @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | 5 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | } # END method run | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | =item C<returnrun> ( @arguments ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | Calls C<run> with @arguments as specified, catching all output destined for STDOUT, and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | returning the results as a string. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | 4 | ▶ | sub returnrun { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
returnrun: called CC=4 SCAR=14.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | 4 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | 4 | ▶ | my $class = ref($self) || return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
ref $self || (return undef)
MC/DC0%0/1
ref $self || (return undef)
ref $self
Truth table50%1/2
A
A= ref $self
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | 4 | local(*XPP_TIE); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | 4 | ▶ | warn "xpp: tying STDOUT" . ($debuglines ? '' : "\n") if ($debug); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | 4 | my $tieobj = tie(*XPP_TIE, 'XPP::Tie'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | 4 | my $fh = select( XPP_TIE ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | 4 | $self->run( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | 4 | select( $fh ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | 4 | my $content = $tieobj->content(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | # untie(*XPP_TIE); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | 4 | return $content; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | } # END method returnrun | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | =item C<load> ( $filename ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | Returns the code specified by $filename. If $filename begins with a url specifier | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | (e.g. http://), LWP::UserAgent will be used to retrieve the file. If $filename | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | begins with a '/', it will be treated as a rooted filename. Otherwise the filename | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | will be as a file relative to XPPIncludeDir | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | 4 | ▶ | sub load { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
load: called CC=18 SCAR=44.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | 4 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | 4 | my $filename = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | 4 | my $counter = shift; # don't recurse | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | 4 | ▶ | warn "xpp: loading source ($filename)" . ($debuglines ? '' : "\n") if ($debug); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | 4 | ▶ | if ((substr($filename,0,1) eq '/') or ((substr($filename,0,2) eq './') and ($counter))) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%4/6
substr($filename, 0, 1) eq "/" or substr($filename, 0, 2) eq "./" and $counter
substr($filename, 0, 2) eq "./" and $counter
MC/DC33%1/3
substr($filename, 0, 1) eq "/" or substr($filename, 0, 2) eq "./" and $counter
substr($filename, 0, 1) eq "/"
substr($filename, 0, 2) eq "./"
$counter
Truth table50%2/4
A or B and C
A= substr($filename, 0, 1) eq "/"B= substr($filename, 0, 2) eq "./"C= $counter
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | 2 | my $fh = new FileHandle; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | 2 | ▶ | warn "xpp:\tattempting to load $filename" . ($debuglines ? '' : "\n") if ($debug); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | # if (($filename =~ m{^(/[/\-\w\.]+)$}) && ($fh->open($1))) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | 2 | ▶ | if ($fh->open($filename)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | 2 | local($/) = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | 2 | return <$fh>; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | 0 | ▶ | warn "xpp:\tfailed to load file $filename ($!)" . ($debuglines ? '' : "\n"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | } elsif ($filename =~ m{^(?:.+)?://(?:.+)$}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | 0 | my $ua = LWP::UserAgent->new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | 0 | my $req = HTTP::Request->new( 'GET', $filename ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | 0 | my $res = $ua->request( $req ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | 0 | ▶ | warn "xpp:\tattempting to load $filename from LWP::UserAgent" . ($debuglines ? '' : "\n") if ($debug); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | 0 | ▶ | if ($res->is_success) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | 0 | return $res->content; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | 0 | ▶ | warn "xpp:\tfailed to load file $filename ($!)" . ($debuglines ? '' : "\n"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | 2 | my $qualified = $self->qualify( $filename ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | 2 | ▶ | warn "xpp:\tqualifying filename, and attempting to load '${qualified}'" . ($debuglines ? '' : "\n") if ($debug); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | 2 | ▶ | return $self->load( $qualified, 1 ) unless ($counter); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | } # END method load | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | 0 | ▶ | sub mtime { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
mtime: not called CC=17 SCAR=57.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | 0 | ▶ | my $filename = ref($self) ? $self->filename : shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | 0 | my $counter = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | 0 | ▶ | warn "xpp: checking mtime of file ($filename)" . ($debuglines ? '' : "\n") if ($debug); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | 0 | ▶ | if (substr($filename,0,1) eq '/') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | 0 | my $mtime = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | 0 | ▶ | unless (-f $filename) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | 0 | my $st = stat($filename); # using File::stat | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | 0 | ▶ | if (ref($st) && $st->can('mtime')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
ref $st and $st->can("mtime")
MC/DC0%0/2
ref $st and $st->can("mtime")
ref $st
$st->can("mtime")
Truth table0%0/3
A and B
A= ref $stB= $st->can("mtime")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | 0 | return $st->mtime; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | 0 | ▶ | warn "xpp:\tcannot stat file ($filename): $!" . ($debuglines ? '' : "\n") if ($debug); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | } elsif ($filename =~ m{^((?:.+)?://(?:.+))$}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | 0 | my $ua = LWP::UserAgent->new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | 0 | my $req = HTTP::Request->new( 'GET', $filename ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | 0 | my $res = $ua->request( $req ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | 0 | ▶ | if (my $headers = $res->headers) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | 0 | return $headers->last_modified; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | 0 | ▶ | warn "xpp:\tfailed to get mtime for url ($!)" . ($debuglines ? '' : "\n") if ($debug); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | 0 | ▶ | warn "xpp:\tattempting to qualify filename, and mtime again '${filename}'" . ($debuglines ? '' : "\n") if ($debug); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | 0 | ▶ | return $self->mtime( $self->qualify( $filename ), 1 ) unless ($counter); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | } # END method mtime | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | =item C<qualify> ( $filename ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | Qualifies the passed name to a fully rooted filename by using either C<incdir> or C<docroot>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | 2 | ▶ | sub qualify { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
qualify: called CC=18 SCAR=47.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | 2 | my $filename = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | 2 | ▶ | carp "xpp: qualifying filename ($filename)" . ($debuglines ? '' : "\n") if ($debug); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | 2 | ▶ | if (substr($filename,0,1) eq '/') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | 0 | ▶ | warn "xpp:\tqualifying document rooted file" . ($debuglines ? '' : "\n") if ($debug >= 2); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | 0 | ▶ | if ($filename =~ m{^(/[/\-\w\.]+)$}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | 0 | return join('', $self->docroot, $1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | } elsif ($filename =~ m{^((?:.+)?://(?:.+))$}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | 0 | ▶ | warn "xpp:\tassuming URL is already qualified" . ($debuglines ? '' : "\n") if ($debug >= 2); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | 0 | return $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | 2 | ▶ | warn "xpp:\tqualifying include rooted file" . ($debuglines ? '' : "\n") if ($debug >= 2); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | 2 | ▶ | warn "xpp:\tfilename: $filename" . ($debuglines ? '' : "\n") if ($debug >= 2);; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | 2 | ▶ | if ($filename =~ m{^([/\-\w\.]+)$}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | 2 | my $r = $self->r(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | 2 | my $incdir = $self->incdir($r); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | 2 | ▶ | return ($incdir) ? join('/', $incdir, $1) : $1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | 0 | ▶ | warn "xpp: qualify failed on filename '$filename'!" . ($debuglines ? '' : "\n") if ($debug); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | } # END method qualify | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | =item C<incdir> ( ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | Returns the include directory from which C<include> and C<xinclude> will retrieve source | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | from by default. See C<include>, C<xinclude>, and C<load> for more documentation on this | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | process. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | 2 | ▶ | sub incdir { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
incdir: called CC=20 SCAR=52.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | 2 | ▶ | my $r = (ref $self) ? $self->r : shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | #Not cleaning up for now, why not cache for the life of a process. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | #$r->register_cleanup(sub {undef $Apache::XPP::_cache::incdir}) unless (defined $Apache::XPP::_cache::incdir); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | 2 | my $incdir; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | 2 | ▶ | unless ( $incdir = $Apache::XPP::_cache::incdir{ $self->server_name } ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | 1 | ▶ | if ($incdir = $self->XPPVHostIncludeDir) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | 0 | my @parts = split(/\./, $r->get_server_name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | 0 | my($segment, $replacement, $startpt, $endpt); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | 0 | ▶ | while ($incdir =~ m/\%([p\d\+\-\.]+)/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | 0 | $segment = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | 0 | ▶ | if ($segment eq 'p') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | 0 | $incdir =~ s/\%p/$self->server_name/e; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | 0 | ▶ | if ($segment eq '0') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | 0 | $incdir =~ s/\%0/$self->server_name/e; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | 0 | ▶ | if ($segment =~ /^-(\d)/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | 0 | $endpt = scalar(@parts) - $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | 0 | ▶ | $startpt = ($incdir =~ /\+$/) ? 0 : $endpt; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | } elsif ($segment =~ /^(\d)/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | 0 | $startpt = $1 - 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | 0 | ▶ | $endpt = ($incdir =~ /\+$/) ? $#parts : $startpt; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | 0 | ▶ | if ( ($startpt > $#parts) || ($endpt > $#parts) || ($startpt < 0) || ($endpt < 0) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/9
$startpt > $#parts or $endpt > $#parts or $startpt < 0 or $endpt < 0
$startpt > $#parts or $endpt > $#parts or $startpt < 0
$startpt > $#parts or $endpt > $#parts
MC/DC0%0/4
$startpt > $#parts or $endpt > $#parts or $startpt < 0 or $endpt < 0
$startpt > $#parts
$endpt > $#parts
$startpt < 0
$endpt < 0
Truth table0%0/5
A or B or C or D
A= $startpt > $#partsB= $endpt > $#partsC= $startpt < 0D= $endpt < 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | 0 | $replacement = '_'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | 0 | $replacement = join('.', @parts[$startpt..$endpt]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | 0 | $incdir =~ s/\%$segment/$replacement/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | 1 | $incdir = $self->XPPIncludeDir(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | 1 | ▶ | warn "XPPIncludeDir => $incdir" if ($debug); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | 1 | ▶ | if (ref($r)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | 0 | ▶ | $incdir = ($incdir =~ m#^/#) ? $incdir : $r->server_root_relative($incdir); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | 0 | ▶ | warn "XPPIncludeDir => $incdir" if ($debug); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | 1 | $incdir =~ s#/$##; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | 1 | $incdir =~ /^(.*)$/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | 1 | $incdir = $Apache::XPP::_cache::incdir{$self->server_name} = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | 1 | ▶ | warn "XPPIncludeDir => $incdir" if ($debug); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | 2 | return $incdir | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | } # END method incdir | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | =item C<docroot> ( ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | Returns the document root directory from which all rooted filenames will be retrieved in | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | C<include>, and C<xinclude>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | 0 | ▶ | sub docroot { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
docroot: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | 0 | ▶ | my $docroot = ref($self->r) ? $self->r->document_root : ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | 0 | ▶ | $docroot ||= '/'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$docroot ||= "/"
MC/DC0%0/1
$docroot ||= "/"
$docroot
Truth table0%0/2
A
A= $docroot
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | 0 | $docroot =~ /^([\/.\w-]*)$/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | 0 | return $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | } # END method docroot | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | =item C<r> ( ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | Returns the Apache request object | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | 25 | ▶ | sub r { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
r: called CC=8 SCAR=28.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | 25 | my $proto = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | 25 | my $data = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | 25 | my $r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | 25 | ▶ | if ($data && ref($proto)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%1/3
$data and ref $proto
MC/DC0%0/2
$data and ref $proto
$data
ref $proto
Truth table33%1/3
A and B
A= $dataB= ref $proto
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | 0 | $r = $proto->{ 'r' } = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | ▶ | } elsif ( ref($proto) && ref($proto->{ 'r' }) ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
ref $proto and ref $proto->{"r"}
MC/DC0%0/2
ref $proto and ref $proto->{"r"}
ref $proto
ref $proto->{"r"}
Truth table66%2/3
A and B
A= ref $protoB= ref $proto->{"r"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | 0 | return $proto->{ 'r' }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | # calling C<request> if the Apache package hadn't been loaded would cause an error | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | 25 | ▶ | if ($INC{ 'Apache.pm' }) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | 0 | ▶ | $r = ( ref($proto) ? ( $proto->{ 'r' } = Apache->request ) : return Apache->request ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | 25 | ▶ | (ref $r) || return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | ### This prevents subrequests from using the wrong request object. Also in new() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | 0 | ▶ | $r->register_cleanup(sub { delete $proto->{'r'}; }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | 0 | return $r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | } # END method r | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | =item C<include> ( $filename ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | Static, unbuffered, unparsed content include. It can be used within an xpml | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | script by simply saying | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | include $filename; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | See the C<load> method for more information | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | 0 | ▶ | sub include ($) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
include: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | 0 | my $filename = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | 0 | return (print $self->load( $self->qualify( $filename ) )); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | } # END method include | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | =item C<xinclude> ( $filename, @options ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | Dynamic, parsed, buffered content include. It can be used within an xpml | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | script by simply saying | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | xinclude $filename; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | 0 | ▶ | sub xinclude { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
xinclude: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | 0 | my $filename = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | 0 | my @options = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | 0 | my $x = $self->new( { filename => $self->qualify( $filename ) } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | 0 | $x->run( @options ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | } # END method xinclude | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | 0 | ▶ | sub XPMLHeaders { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
XPMLHeaders: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | 0 | ▶ | my $data = ref($self) ? $self->{ 'XPMLHeaders' } : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | 0 | ▶ | $data ||= ref($self->r) ? $self->r->dir_config( 'XPMLHeaders' ) : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$data ||= ref $self->r ? $self->r->dir_config("XPMLHeaders") : undef
MC/DC0%0/2
$data ||= ref $self->r ? $self->r->dir_config("XPMLHeaders") : undef
$data
ref $self->r ? $self->r->dir_config("XPMLHeaders") : undef
Truth table0%0/3
A ||= B
A= $dataB= ref $self->r ? $self->r->dir_config("XPMLHeaders") : undef
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | 0 | return $data; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | 0 | ▶ | sub XPMLFooters { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
XPMLFooters: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | 0 | ▶ | my $data = ref($self) ? $self->{ 'XPMLFooters' } : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | 0 | ▶ | $data ||= ref($self->r) ? $self->r->dir_config( 'XPMLFooters' ) : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$data ||= ref $self->r ? $self->r->dir_config("XPMLFooters") : undef
MC/DC0%0/2
$data ||= ref $self->r ? $self->r->dir_config("XPMLFooters") : undef
$data
ref $self->r ? $self->r->dir_config("XPMLFooters") : undef
Truth table0%0/3
A ||= B
A= $dataB= ref $self->r ? $self->r->dir_config("XPMLFooters") : undef
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | 0 | return $data; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | 6 | ▶ | sub XPPIncludeDir { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
XPPIncludeDir: called CC=4 SCAR=14.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | 6 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | 6 | ▶ | my $data = ref($self) ? $self->{ 'XPPIncludeDir' } : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | 6 | ▶ | $data ||= ref($self->r) ? $self->r->dir_config( 'XPPIncludeDir' ) : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$data ||= ref $self->r ? $self->r->dir_config("XPPIncludeDir") : undef
MC/DC50%1/2
$data ||= ref $self->r ? $self->r->dir_config("XPPIncludeDir") : undef
$data
ref $self->r ? $self->r->dir_config("XPPIncludeDir") : undef
Truth table66%2/3
A ||= B
A= $dataB= ref $self->r ? $self->r->dir_config("XPPIncludeDir") : undef
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | 6 | return $data; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | 1 | ▶ | sub XPPVHostIncludeDir { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
XPPVHostIncludeDir: called CC=4 SCAR=15.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | 1 | ▶ | my $data = ref($self) ? $self->{ 'XPPVHostIncludeDir' } : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | 1 | ▶ | $data ||= ref($self->r) ? $self->r->dir_config( 'XPPVHostIncludeDir' ) : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$data ||= ref $self->r ? $self->r->dir_config("XPPVHostIncludeDir") : undef
MC/DC0%0/2
$data ||= ref $self->r ? $self->r->dir_config("XPPVHostIncludeDir") : undef
$data
ref $self->r ? $self->r->dir_config("XPPVHostIncludeDir") : undef
Truth table33%1/3
A ||= B
A= $dataB= ref $self->r ? $self->r->dir_config("XPPVHostIncludeDir") : undef
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | 1 | return $data; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | 3 | ▶ | sub server_name { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
server_name: called CC=4 SCAR=17.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | 3 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | 3 | ▶ | my $data = ref($self) ? $self->{ 'server_name' } : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | 3 | ▶ | $data ||= ref($self->r) ? $self->r->get_server_name : 'localhost'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$data ||= ref $self->r ? $self->r->get_server_name : "localhost"
MC/DC0%0/2
$data ||= ref $self->r ? $self->r->get_server_name : "localhost"
$data
ref $self->r ? $self->r->get_server_name : "localhost"
Truth table33%1/3
A ||= B
A= $dataB= ref $self->r ? $self->r->get_server_name : "localhost"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | 3 | return $data; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | =item C<debug> ( $debuglevel [, $debuglines ] ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | Manipulates debug level. See $debug above. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | N.B. -- at present these flags are global, not per object. Method works | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | as static or dynamic. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | 0 | ▶ | sub debug { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
debug: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | 0 | ▶ | (defined $_[2]) && ($debuglines = $_[1]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | 0 | ▶ | (defined $_[1]) ? $debug = $_[1] : $debug; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | } # END method debug | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | 49 | ▶ | sub AUTOLOAD { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
AUTOLOAD: called CC=4 SCAR=14.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | 49 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | 49 | ▶ | my $class = ref($self) || return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
ref $self || (return undef)
MC/DC0%0/1
ref $self || (return undef)
ref $self
Truth table50%1/2
A
A= ref $self
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | 49 | my $name = $AUTOLOAD; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | 49 | ▶ | return undef if (substr($name,-9) eq '::DESTROY'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | 49 | $name =~ s/^.*://; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | 49 | ▶ | if (scalar(@_)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | 20 | return ($self->{ $name } = shift); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | 29 | return $self->{ $name }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | } # END method AUTOLOAD | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | 45 | ▶ | sub preparseclass { 'Apache::XPP::PreParse' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
preparseclass: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 748 | package Apache::XPP::Page; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 749 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 750 | =item include( $inc_location ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 751 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 752 | Returns the plaintext of the include file $inc_location. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 753 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 754 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 755 | 0 | ▶ | sub include { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
include: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 756 | 0 | return Apache::XPP->include( shift ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 757 | } # END method include | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 758 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 759 | =item xinclude( $inc_location, @ARGS ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 760 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 761 | Returns the XPP parsed text of the include file $inc_location, passing @ARGS to the page as arguments. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 762 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 763 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 764 | 0 | ▶ | sub xinclude { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
xinclude: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 765 | 0 | return $Apache::XPP::main_class->xinclude( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 766 | } # END method xinclude | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 767 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 768 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 769 | package XPP::Tie; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 770 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 771 | 3 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 772 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 773 | 3 | ▶ | use vars qw( $debug $debuglines ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 774 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 775 | # Debugging uses debug settings of Apache::XPP | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 776 | 3 | $debug = \$Apache::XPP::debug; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 777 | 3 | $debuglines = \$Apache::XPP::debuglines; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 778 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 779 | 4 | ▶ | sub TIEHANDLE { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
TIEHANDLE: called CC=2 SCAR=7.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 780 | 4 | my $proto = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 781 | 4 | ▶ | my $class = ref($proto) || $proto; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
ref $proto || $proto
MC/DC0%0/2
ref $proto || $proto
ref $proto
$proto
Truth table33%1/3
A || B
A= ref $protoB= $proto
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 782 | 4 | my $content = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 783 | 4 | my $self = bless(\$content, $class); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 784 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 785 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 786 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 787 | 8 | ▶ | sub PRINT { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
PRINT: called CC=6 SCAR=22.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 788 | 8 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 789 | 8 | ▶ | warn "tie: caught print" . ($$debuglines ? '' : "\n") if ($$debug); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 790 | 8 | ▶ | warn "tie:\t@_" . ($$debuglines ? '' : "\n") if ($$debug >= 2); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 791 | 8 | ▶ | ${ $self } .= join($,, @_) . (defined($\) ? $\ : ''); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 792 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 793 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 794 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 795 | 0 | ▶ | sub PRINTF { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
PRINTF: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 796 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 797 | 0 | ▶ | warn "tie: caught printf" . ($$debuglines ? '' : "\n") if ($$debug); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 798 | 0 | ▶ | warn "tie:\t" . sprintf( @_ ) . ($$debuglines ? '' : "\n") if ($$debug >= 2); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 799 | 0 | ${ $self } .= sprintf( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 800 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 801 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 802 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 803 | 4 | ▶ | sub content { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
content: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 804 | 4 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 805 | 4 | return ${ $self }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 806 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 807 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 808 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 809 | 3 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 810 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 811 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||