blib/lib/CGI/Builder/CgiAppAPI.pm

filter: Statementstmt 71.5% 151 / 211 Branchbran 46.4% 66 / 142 Conditioncond 48.0% 24 / 50 MC/DCmcdc 25.0% 7 / 28 Subroutinesub 72.0% 31 / 43 Podpod 50.0% 9 / 18 totaltotal 58.5% 288 / 492 CC 89 SCAR 27.1
CC
89
Cov
60%
load_tmpl
72.0
switch_to
30.8
checkRM
20.0
CRAP 15.0
↑ Summary
1 package CGI::Builder::CgiAppAPI ;
2 7 $VERSION = 1.27 ;
3 7 ▶use strict ;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 # This file uses the "Perlish" coding style
6 # please read http://perl.4pro.net/perlish_coding_style.html
7  
8 7 ▶; no warnings 'redefine'
Subroutine BEGIN: called CC=1 SCAR=0.0
9 7 ; use CGI::Carp
10 7 ▶; $Carp::Internal{+__PACKAGE__}++
Subroutine BEGIN: called CC=1 SCAR=0.0
11 7 ; our $hints
12 ######### OLD CGI APP ############
13  
14 7 ▶; use CGI::Builder::Const qw| :all |
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 7 ; BEGIN
17 7 ▶ { *QUERY
Subroutine BEGIN: called CC=1 SCAR=0.2
18 = *query
19 32 ▶ = sub : lvalue
Subroutine __ANON__: called CC=2 SCAR=7.2
20 32 ▶ { $hints && carp
Branch: 1 branch
BranchTrueFalseTotal
$CGI::Builder::CgiAppAPI::hints and carp("Just change 'QUERY' or 'query' with 'cgi'") 0 32 32
21 qq(Just change 'QUERY' or 'query' with 'cgi')
22 32 ; shift()->cgi(@_)
23 }
24
25 7 ; *PARAMS
26 = sub
27 1 ▶ { $hints && carp
Subroutine __ANON__: called CC=2 SCAR=7.2
Branch: 1 branch
BranchTrueFalseTotal
$CGI::Builder::CgiAppAPI::hints and carp("Just change 'PARAMS' with 'param'") 0 1 1
28 qq(Just change 'PARAMS' with 'param')
29 1 ; shift()->param(@_)
30 }
31  
32 7 ; *TMPL_PATH
33 = *tmpl_path
34 0 ▶ = sub : lvalue
Subroutine __ANON__: not called CC=2 SCAR=17.9
35 0 ▶ { $hints && carp
Branch: 1 branch
BranchTrueFalseTotal
$CGI::Builder::CgiAppAPI::hints and carp("Just change 'TMPL_PATH' or 'tmpl_path' with 'page_path'") 0 0 0
36 qq(Just change 'TMPL_PATH' or 'tmpl_path' with 'page_path')
37 0 ; shift()->page_path(@_)
38 }
39  
40 7 ; *start_mode
41 = *get_current_runmode
42 = *runmode
43 29 ▶ = sub : lvalue
Subroutine __ANON__: called CC=2 SCAR=7.2
44 29 ▶ { $hints && carp
Branch: 1 branch
BranchTrueFalseTotal
$CGI::Builder::CgiAppAPI::hints and carp("Just change 'start_mode', 'get_current_runmode' or 'runmode' with 'page_name' and remember that the 'page_name' default is 'index' instead of 'start'") 0 29 29
45 qq(Just change 'start_mode', 'get_current_runmode' or 'runmode' )
46 . qq(with 'page_name' and remember that the 'page_name' default )
47 . qq(is 'index' instead of 'start')
48 29 ; shift()->page_name(@_)
49 }
50  
51 7 ; *prerun_mode
52 = sub
53 3 ▶ { $hints && carp
Subroutine __ANON__: called CC=2 SCAR=7.2
Branch: 1 branch
BranchTrueFalseTotal
$CGI::Builder::CgiAppAPI::hints and carp("Just change 'prerun_mode' with 'switch_to'") 0 3 3
54 qq(Just change 'prerun_mode' with 'switch_to')
55 3 ; shift()->switch_to(@_)
56 }
57  
58 7 ; *header_props
59 = *header_add
60 = sub
61 3 ▶ { $hints && carp
Subroutine __ANON__: called CC=2 SCAR=7.2
Branch: 1 branch
BranchTrueFalseTotal
$CGI::Builder::CgiAppAPI::hints and carp("Just change 'header_props' or 'header_add' with 'header'") 0 3 3
62 qq(Just change 'header_props' or 'header_add' with 'header')
63 3 ; shift()->header(@_)
64 }
65
66  
67 7 ; *page
68 25 ▶ = sub : lvalue
Subroutine __ANON__: called CC=2 SCAR=7.2
69 25 ▶ { $hints && carp
Branch: 1 branch
BranchTrueFalseTotal
$CGI::Builder::CgiAppAPI::hints and carp("Just change 'page' with 'page_content'") 0 25 25
70 qq(Just change 'page' with 'page_content')
71 25 ; shift()->page_content(@_)
72 }
73
74 7 ; *mode_param
75 12 ▶ = sub : lvalue
Subroutine __ANON__: called CC=2 SCAR=7.2
76 12 ▶ { $hints && carp
Branch: 1 branch
BranchTrueFalseTotal
$CGI::Builder::CgiAppAPI::hints and carp("Change 'mode_param' with 'cgi_page_param' and remember that the 'cgi_page_param' default is 'p' instead of 'rm'") 0 12 12
77 qq(Change 'mode_param' with 'cgi_page_param' )
78 . qq(and remember that the 'cgi_page_param' default )
79 . qq(is 'p' instead of 'rm')
80 12 ; shift()->cgi_page_param(@_)
81 }
82
83 7 ; *run_modes
84 = sub
85 30 ▶ { $hints && carp
Subroutine __ANON__: called CC=2 SCAR=7.2
Branch: 1 branch
BranchTrueFalseTotal
$CGI::Builder::CgiAppAPI::hints and carp("Change 'run_modes' with 'page_handler_map', and be aware that this method could be unnecessary") 0 30 30
86 qq(Change 'run_modes' with 'page_handler_map', )
87 . qq(and be aware that this method could be unnecessary)
88 30 ; shift()->page_handler_map(@_)
89 }
90 7 }
91  
92
93 # alias to make the CGI_APP_RETURN_ONLY work
94 ; sub run
95 27 ▶ { my $s = shift
Subroutine run: called CC=4 SCAR=15.0
Pod documented
96 27 ▶ ; $hints && carp
Branch: 1 branch
BranchTrueFalseTotal
$CGI::Builder::CgiAppAPI::hints and carp("Just change 'run' with 'process'") 0 27 27
97 qq(Just change 'run' with 'process')
98 27 ▶ ; if ( $ENV{CGI_APP_RETURN_ONLY} )
Branch: 1 branch
BranchTrueFalseTotal
if ($ENV{'CGI_APP_RETURN_ONLY'}) { } 27 0 27
99 27 ▶ { $hints && carp
Branch: 1 branch
BranchTrueFalseTotal
$CGI::Builder::CgiAppAPI::hints and carp("'\$ENV{CGI_APP_RETURN_ONLY}' is an obsolete way to capture the output: use 'capture()' method instead") 0 27 27
100 qq('\$ENV{CGI_APP_RETURN_ONLY}' is an obsolete way to capture )
101 . qq(the output: use 'capture()' method instead)
102 27 ; ${$s->capture('process')}
103 }
104 else
105 0 { $s->process(@_)
106 }
107 }
108
109 ; sub get_page_name
110 27 ▶ { my $s = shift
Subroutine get_page_name: called CC=5 SCAR=16.2
Pod undocumented
111 27 ; my $p
112 27 ▶ ; if ( ref $s->cgi_page_param eq 'CODE' )
Branch: 1 branch
BranchTrueFalseTotal
if (ref $s->cgi_page_param eq 'CODE') { } 3 24 27
113 3 ▶ { $hints && carp
Branch: 1 branch
BranchTrueFalseTotal
$CGI::Builder::CgiAppAPI::hints and carp("The 'cgi_page_param' property should not be a CODE ref; in this case just override the 'get_page_name()' method") 0 3 3
114 qq(The 'cgi_page_param' property should not be a CODE ref; )
115 . qq(in this case just override the 'get_page_name()' method)
116 3 ; $p = $s->cgi_page_param->($s)
117 }
118 else
119 24 { $p = $s->cgi->param($s->cgi_page_param)
120 }
121 27 ▶ ; $s->page_name($p) if defined $p && length $p
Branch: 1 branch
BranchTrueFalseTotal
if defined $p and length $p 19 8 27
Condition66%2/3
defined $p and length $p
!ll&&!rl&&r
8019
MC/DC50%1/2
defined $p and length $p
defined $p length $p
Truth table66%2/3
A and B
A= defined $pB= length $p
ABresult
0X0
100
111
122 }
123  
124 7 ; my $exec = \&CGI::Builder::_::exec
125  
126  
127 ; sub switch_to # PHASE must be PRE_PROCESS or FIXUP
128 30 ▶ { my ($s, $p, @args) = @_ ;
Subroutine switch_to: called CC=25 SCAR=34.3
Pod undocumented
129 6 ▶ ; local $SIG{__DIE__} = sub{$s->die_handler(@_)}
Subroutine __ANON__: called CC=1 SCAR=0.0
130  
131 30 ▶ ; $s->PHASE < PRE_PROCESS && croak
Branch: 1 branch
BranchTrueFalseTotal
$s->PHASE < 2 and croak("Too early to call switch_to()") 1 29 30
132 qq(Too early to call switch_to())
133 29 ▶ ; $s->PHASE > FIXUP && croak
Branch: 1 branch
BranchTrueFalseTotal
$s->PHASE > 6 and croak("Too late to call switch_to()") 0 29 29
134 qq(Too late to call switch_to())
135 29 ▶ ; defined $p && length $p || croak qq(No page_name name passed)
Branch: 1 branch
BranchTrueFalseTotal
defined $p and length $p or croak("No page_name name passed") 29 0 29
Condition33%1/3
defined $p and length $p
!ll&&!rl&&r
0029
MC/DC0%0/2
defined $p and length $p
defined $p length $p
Truth table33%1/3
A and B
A= defined $pB= length $p
ABresult
0X0
100
111
136 29 ; $s->page_name($p)
137  
138 29 ; $s->PHASE(SWITCH_HANDLER)
139 29 ; my $shm = $s->switch_handler_map
140 29 ▶ ; my $switch_handler = $$shm{$p} || $s->can("SH_$p")
Condition33%1/3
$shm->{$p} || $s->can("SH_$p")
l!l&&r!l&&!r
0029
MC/DC0%0/2
$shm->{$p} || $s->can("SH_$p")
$shm->{$p} $s->can("SH_$p")
Truth table33%1/3
A || B
A= $shm->{$p}B= $s->can("SH_$p")
ABresult
1X1
011
000
141 29 ▶ ; $s->$switch_handler() if $switch_handler
Branch: 1 branch
BranchTrueFalseTotal
if $switch_handler 0 29 29
142  
143 29 ▶ ; if ($s->PHASE < PRE_PAGE)
Branch: 1 branch
BranchTrueFalseTotal
if ($s->PHASE < 4) 29 0 29
144 29 { $s->PHASE(PRE_PAGE)
145 29 ; $s->$exec('pre_page')
146 }
147
148 29 ▶ ; if ( $s->PHASE < PAGE_HANDLER )
Branch: 1 branch
BranchTrueFalseTotal
if ($s->PHASE < 5) 29 0 29
149 29 { $s->PHASE(PAGE_HANDLER)
150 29 ; my $phm = $s->page_handler_map
151 29 ; my $RM = $s->RM_prefix
152 29 ; my $al
153 ; my $page_handler
154 = $$phm{$p}
155 || $s->can("PH_$p")
156 8 || do{ my $h = $s->can($RM.$p)
157 8 ▶ ; $h && $hints && ($RM ne 'PH_') && carp
Branch: 1 branch
BranchTrueFalseTotal
$h and $CGI::Builder::CgiAppAPI::hints and $RM ne "PH_" and carp("Your are using '${RM}' as the prefix of your " . 'run methods (Page Handlers). Change it with ' . "'PH_' in all the run methods that use it") 0 8 8
Condition50%3/6
$h and $CGI::Builder::CgiAppAPI::hints and $RM ne "PH_"
!ll&&!rl&&r
800
$h and $CGI::Builder::CgiAppAPI::hints
!ll&&!rl&&r
260
MC/DC0%0/3
$h and $CGI::Builder::CgiAppAPI::hints and $RM ne "PH_"
$h $CGI::Builder::CgiAppAPI::hints $RM ne "PH_"
Truth table50%2/4
A and B and C
A= $hB= $CGI::Builder::CgiAppAPI::hintsC= $RM ne "PH_"
ABCresult
0XX0
10X0
1100
1111
158 qq(Your are using '$RM' as the prefix of your )
159 . qq(run methods \(Page Handlers\). Change it with )
160 . qq('PH_' in all the run methods that use it)
161 8 ; $h
162 }
163 29 ▶ || do{ unless ($s->page_content_check)
Branch: 1 branch
BranchTrueFalseTotal
unless ($s->page_content_check) 2 0 2
Condition88%8/9
$phm->{$p} || $s->can("PH_$p") || do { my $h = $s->can($RM . $p); $h and $CGI::Builder::CgiAppAPI::hints and $RM ne 'PH_' and carp("Your are using '${RM}' as the prefix of your " . 'run methods (Page Handlers). Change it with ' . q['PH_' in all the run methods that use it]); $h } || do { unless ($s->page_content_check) { my $h = $phm->{'AUTOLOAD'} || $s->can('PH_AUTOLOAD'); $h and ++$al and $h; } }
l!l&&r!l&&!r
2711
$phm->{$p} or $s->can("PH_$p") or do { my $h = $s->can($RM . $p); $h and $CGI::Builder::CgiAppAPI::hints and $RM ne "PH_" and carp("Your are using '${RM}' as the prefix of your " . 'run methods (Page Handlers). Change it with ' . "'PH_' in all the run methods that use it"); $h }
l!l&&r!l&&!r
2162
$phm->{$p} or $s->can("PH_$p")
l!l&&r!l&&!r
2108
MC/DC75%3/4
$phm->{$p} || $s->can("PH_$p") || do { my $h = $s->can($RM . $p); $h and $CGI::Builder::CgiAppAPI::hints and $RM ne 'PH_' and carp("Your are using '${RM}' as the prefix of your " . 'run methods (Page Handlers). Change it with ' . q['PH_' in all the run methods that use it]); $h } || do { unless ($s->page_content_check) { my $h = $phm->{'AUTOLOAD'} || $s->can('PH_AUTOLOAD'); $h and ++$al and $h; } }
$phm->{$p} $s->can("PH_$p") do { my $h = $s->can($RM . $p); $h and $CGI::Builder::CgiAppAPI::hints and $RM ne "PH_" and carp("Your are using '${RM}' as the prefix of your " . 'run methods (Page Handlers). Change it with ' . "'PH_' in all the run methods that use it"); $h } do { unless ($s->page_content_check) { my $h = $phm->{'AUTOLOAD'} || $s->can('PH_AUTOLOAD'); $h and ++$al and $h; } }
Truth table80%4/5
A or B or C || D
A= $phm->{$p}B= $s->can("PH_$p")C= do { my $h = $s->can($RM . $p); $h and $CGI::Builder::CgiAppAPI::hints and $RM ne "PH_" and carp("Your are using '${RM}' as the prefix of your " . 'run methods (Page Handlers). Change it with ' . "'PH_' in all the run methods that use it"); $h }D= do { unless ($s->page_content_check) { my $h = $phm->{'AUTOLOAD'} || $s->can('PH_AUTOLOAD'); $h and ++$al and $h; } }
ABCDresult
1XXX1
01XX1
001X1
00011
00000
164 2 ▶ { my $h = $$phm{'AUTOLOAD'} || $s->can('PH_AUTOLOAD')
Condition66%2/3
$phm->{'AUTOLOAD'} || $s->can('PH_AUTOLOAD')
l!l&&r!l&&!r
101
MC/DC50%1/2
$phm->{'AUTOLOAD'} || $s->can('PH_AUTOLOAD')
$phm->{'AUTOLOAD'} $s->can('PH_AUTOLOAD')
Truth table66%2/3
A || B
A= $phm->{'AUTOLOAD'}B= $s->can('PH_AUTOLOAD')
ABresult
1X1
011
000
165 2 ▶ ; $h && ++ $al && $h
Condition66%4/6
$h && ++$al && $h
!ll&&!rl&&r
101
$h and ++$al
!ll&&!rl&&r
101
MC/DC33%1/3
$h && ++$al && $h
$h ++$al $h
Truth table50%2/4
A and B && C
A= $hB= ++$alC= $h
ABCresult
0XX0
10X0
1100
1111
166 }
167 }
168 29 ; my $pc
169 29 ▶ ; if ( $page_handler )
Branch: 1 branch
BranchTrueFalseTotal
if ($page_handler) 28 1 29
170 28 ▶ { if ($al)
Branch: 1 branch
BranchTrueFalseTotal
if ($al) 1 27 28
171 1 ▶ { $hints && carp
Branch: 1 branch
BranchTrueFalseTotal
$CGI::Builder::CgiAppAPI::hints and carp("Remember that the 'page_name' (former run mode) is no longer passed as an argument to the AUTOLOAD page handler (former run method); You should use the 'page_name' property in place of the passed argument") 0 1 1
172 qq(Remember that the 'page_name' \(former run mode\) is no )
173 . qq(longer passed as an argument to the AUTOLOAD page handler )
174 . qq(\(former run method\); You should use the 'page_name' )
175 . qq(property in place of the passed argument)
176 1 ; unshift @args, $s->page_name
177 }
178 28 ; $pc = $s->$page_handler( @args )
179 }
180
181 28 ▶ ; unless ( length $s->page_content )
Branch: 1 branch
BranchTrueFalseTotal
unless (length $s->page_content) 21 7 28
182 21 ▶ { $hints && carp
Branch: 1 branch
BranchTrueFalseTotal
$CGI::Builder::CgiAppAPI::hints and carp("A page handler (former run method) should set the 'page_content' property with the value it is returning right now") 0 21 21
183 qq(A page handler \(former run method\) should set )
184 . qq(the 'page_content' property with the value it is )
185 . qq(returning right now)
186 21 ▶ ; $page_handler
Branch: 1 branch
BranchTrueFalseTotal
$page_handler or croak("No page handler found for page '${\$s->page_name;}'") 20 1 21
187 1 || croak qq(No page handler found for page '${\$s->page_name}')
188 20 ; $s->page($pc)
189 }
190 }
191 }
192
193 ; sub send_header
194 26 ▶ { my $s = shift
Subroutine send_header: called CC=7 SCAR=19.6
Pod undocumented
195 26 ; my $ht = $s->header_type
196 26 ▶ ; if ($ht eq 'redirect')
Branch: 2 branches
BranchTrueFalseTotal
if ($ht eq 'redirect') { } 2 24 26
elsif ($ht eq 'none') { } 1 23 24
197 2 ▶ { $hints && carp
Branch: 1 branch
BranchTrueFalseTotal
$CGI::Builder::CgiAppAPI::hints and carp("Change the 'redirect' header_type with the 'redirect()' method") 0 2 2
198 qq(Change the 'redirect' header_type with the 'redirect()' method)
199 2 ; $s->PHASE(REDIR)
200 2 ; print $s->cgi->redirect( %{$s->header} )
201 }
202 elsif ($ht eq 'none')
203 1 ▶ { $hints && carp
Branch: 1 branch
BranchTrueFalseTotal
$CGI::Builder::CgiAppAPI::hints and carp("Change the 'none' 'header_type' with the 'dont_send_header' boolean property set to 1") 0 1 1
204 qq(Change the 'none' 'header_type' with the 'dont_send_header' )
205 . qq(boolean property set to 1)
206 }
207 26 ▶ ; print $s->cgi->header( %{$s->header} )
Branch: 1 branch
BranchTrueFalseTotal
unless $ht eq "none" or $s->dont_send_header 25 1 26
Condition66%2/3
$ht eq "none" or $s->dont_send_header
l!l&&r!l&&!r
1025
MC/DC50%1/2
$ht eq "none" or $s->dont_send_header
$ht eq "none" $s->dont_send_header
Truth table66%2/3
A or B
A= $ht eq "none"B= $s->dont_send_header
ABresult
1X1
011
000
208 unless ( $ht eq 'none'
209 || $s->dont_send_header
210 )
211 }
212  
213
214 # override to set old defaults
215 ; use Object::props
216 7 ▶ ( { name => 'cgi_page_param'
Subroutine BEGIN: called CC=1 SCAR=0.9
217 , default => 'rm'
218 }
219 , { name => 'page_name'
220 , default => sub
221 1 ▶ { $_[0]->isa('CGI::Builder::Magic')
Subroutine __ANON__: called CC=2 SCAR=7.6
Branch: 1 branch
BranchTrueFalseTotal
$_[0]->isa('CGI::Builder::Magic') ? : 0 1 1
222 ? 'index'
223 : 'start'
224 }
225 }
226 , { name => 'header_type'
227 , default => 'header'
228 26 ▶ , validation => sub{ /^(header|redirect|none)$/ }
Subroutine __ANON__: called CC=1 SCAR=0.0
229 }
230 , { name => 'RM_prefix'
231 , no_strict => 1
232 , validation => sub
233 0 ▶ { $hints && carp
Subroutine __ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
$CGI::Builder::CgiAppAPI::hints and carp("The 'RM_prefix' property is not supported: change the prefixes of your run modes with the constant prefix 'PH_' (Page Handler)") 0 0 0
234 qq(The 'RM_prefix' property is not supported: )
235 . qq(change the prefixes of your run modes with the )
236 . qq(constant prefix 'PH_' \(Page Handler\))
237 0 ; 1
238 }
239 7 , default => 'RM_'
240 }
241 )
242  
243 # override to be same as the original
244 7 ; use Object::groups
245 7 ▶ (
Subroutine BEGIN: called CC=1 SCAR=0.8
246 { name => 'page_handler_map'
247 , pre_process => sub
248 65 ▶ { if ( ref $_[1] eq 'ARRAY' )
Subroutine __ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
if (ref $_[1] eq "ARRAY") 7 58 65
249 7 { $_[1] = { map { $_=>$_ } @{$_[1]} }
250 }
251 }
252 }
253 ,
254 { name => 'qparam'
255 , default => sub
256 0 ▶ { $hints && carp
Subroutine __ANON__: not called CC=3 SCAR=24.8
Branch: 1 branch
BranchTrueFalseTotal
$CGI::Builder::CgiAppAPI::hints and carp("The 'qparam' method is not supported. Use \$s->cgi->Vars or implement yours.") 0 0 0
257 qq(The 'qparam' method is not supported. Use )
258 . qq(\$s->cgi->Vars or implement yours.)
259 0 ▶ ; eval{ scalar $_[0]->cgi->Vars }
Branch: 1 branch
BranchTrueFalseTotal
eval { do { scalar $_[0]->cgi->Vars } } or croak("The query object cannot 'Vars', you cannot use the 'qparam' property.") 0 0 0
260 || croak qq(The query object cannot 'Vars', )
261 . qq(you cannot use the 'qparam' )
262 . qq(property.)
263 }
264 }
265  
266 )
267  
268  
269 7 ; sub load_tmpl
270 0 ▶ { my $s = shift
Subroutine load_tmpl: not called CC=8 SCAR=42.8
Pod documented
271 0 ; my ($tmpl_file, @extra_params) = @_
272 0 ▶ ; $hints && carp
Branch: 1 branch
BranchTrueFalseTotal
$CGI::Builder::CgiAppAPI::hints and carp("You should include 'CGI::Builder::HTMLtmpl' in your build and use that integration instaead of 'load_tmpl'") 0 0 0
273 qq(You should include 'CGI::Builder::HTMLtmpl' )
274 . qq(in your build and use that integration instaead of 'load_tmpl')
275 # add tmpl_path to path array of one is set, otherwise add a path arg
276 0 ▶ ; if (my $tmpl_path = $s->page_path)
Branch: 1 branch
BranchTrueFalseTotal
if (my $tmpl_path = $s->page_path) 0 0 0
277 0 { my $found = 0
278 0 ▶ ; for( my $x = 0
Branch: 1 branch
BranchTrueFalseTotal
if ($x < @extra_params) 0 0 0
279 ; $x < @extra_params
280 ; $x += 2
281 )
282 0 ▶ { if ( $extra_params[$x] eq 'path'
Branch: 1 branch
BranchTrueFalseTotal
if ($extra_params[$x] eq "path" and ref $extra_params[$x + 1] and ref $extra_params[$x + 1] eq "ARRAY") 0 0 0
Condition0%0/6
$extra_params[$x] eq "path" and ref $extra_params[$x + 1] and ref $extra_params[$x + 1] eq "ARRAY"
!ll&&!rl&&r
000
$extra_params[$x] eq "path" and ref $extra_params[$x + 1]
!ll&&!rl&&r
000
MC/DC0%0/3
$extra_params[$x] eq "path" and ref $extra_params[$x + 1] and ref $extra_params[$x + 1] eq "ARRAY"
$extra_params[$x] eq "path" ref $extra_params[$x + 1] ref $extra_params[$x + 1] eq "ARRAY"
Truth table0%0/4
A and B and C
A= $extra_params[$x] eq "path"B= ref $extra_params[$x + 1]C= ref $extra_params[$x + 1] eq "ARRAY"
ABCresult
0XX0
10X0
1100
1111
283 and ref $extra_params[$x+1]
284 and ref $extra_params[$x+1] eq 'ARRAY'
285 )
286 0 { unshift @{$extra_params[$x+1]}, $tmpl_path
287 0 ; $found = 1
288 ; last
289 0 }
290 }
291 0 ▶ ; push ( @extra_params
Branch: 1 branch
BranchTrueFalseTotal
unless $found 0 0 0
292 , path => [ $tmpl_path ]
293 )
294 unless $found
295 }
296 ; require HTML::Template
297 0 ; my $t = HTML::Template->new_file( $tmpl_file
298 , @extra_params
299 )
300 0 ; return $t
301 }
302  
303 ; sub dump
304 0 ▶ { my $s = @_
Subroutine dump: not called CC=3 SCAR=24.8
Pod documented
305 0 ▶ ; $hints && not($s->isa('CGI::Builder::Test')) && carp
Branch: 1 branch
BranchTrueFalseTotal
$CGI::Builder::CgiAppAPI::hints and not $s->isa("CGI::Builder::Test") and carp("You should include 'CGI::Builder::Test' in your build in order to use the 'dump()' method") 0 0 0
Condition0%0/3
$CGI::Builder::CgiAppAPI::hints and not $s->isa("CGI::Builder::Test")
!ll&&!rl&&r
000
MC/DC0%0/2
$CGI::Builder::CgiAppAPI::hints and not $s->isa("CGI::Builder::Test")
$CGI::Builder::CgiAppAPI::hints not $s->isa("CGI::Builder::Test")
Truth table0%0/3
A and not(B)
A= $CGI::Builder::CgiAppAPI::hintsB= not $s->isa("CGI::Builder::Test")
ABresult
0X0
100
111
306 qq(You should include 'CGI::Builder::Test' )
307 . qq(in your build in order to use the 'dump()' method)
308 ; require CGI::Builder::Test
309 0 ; goto &CGI::Builder::Test::dump
310 }
311  
312 ; sub dump_html
313 1 ▶ { my $s = @_
Subroutine dump_html: called CC=3 SCAR=12.0
Pod documented
314 1 ▶ ; $hints && not($s->isa('CGI::Builder::Test')) && carp
Branch: 1 branch
BranchTrueFalseTotal
$CGI::Builder::CgiAppAPI::hints and not $s->isa("CGI::Builder::Test") and carp("You should include 'CGI::Builder::Test' in your build in order to use the 'dump_html()' method") 0 1 1
Condition33%1/3
$CGI::Builder::CgiAppAPI::hints and not $s->isa("CGI::Builder::Test")
!ll&&!rl&&r
100
MC/DC0%0/2
$CGI::Builder::CgiAppAPI::hints and not $s->isa("CGI::Builder::Test")
$CGI::Builder::CgiAppAPI::hints not $s->isa("CGI::Builder::Test")
Truth table33%1/3
A and not(B)
A= $CGI::Builder::CgiAppAPI::hintsB= not $s->isa("CGI::Builder::Test")
ABresult
0X0
100
111
315 qq(You should include 'CGI::Builder::Test' )
316 . qq(in your build in order to use the 'dump_html()' method)
317 ; require CGI::Builder::Test
318 1 ; goto &CGI::Builder::Test::dump_html
319 }
320  
321
322 ; sub checkRM
323 0 ▶ { my $s = @_
Subroutine checkRM: not called CC=4 SCAR=30.0
Pod documented
324 0 ▶ ; if ( $hints )
Branch: 1 branch
BranchTrueFalseTotal
if ($CGI::Builder::CgiAppAPI::hints) 0 0 0
325 0 ▶ { $s->isa('CGI::Application::CheckRM') && carp
Branch: 1 branch
BranchTrueFalseTotal
$s->isa("CGI::Application::CheckRM") and carp("You should not use 'CGI::Application::CheckRM' in your build") 0 0 0
326 qq(You should not use 'CGI::Application::CheckRM' in your build)
327
328 0 ▶ ; not($s->isa('CGI::Builder::DFVCheck')) && carp
Branch: 1 branch
BranchTrueFalseTotal
$s->isa("CGI::Builder::DFVCheck") or carp("You should include 'CGI::Builder::DFVCheck' in your build") 0 0 0
329 qq(You should include 'CGI::Builder::DFVCheck' in your build)
330
331 0 ; carp qq(Change 'checkRM' with 'dfv_check')
332 }
333 ; require CGI::Builder::DFVCheck
334 0 ; goto &CGI::Builder::DFVCheck::dfv_check
335 }
336
337 ; sub tm_defaults
338 0 ▶ { my $s = @_
Subroutine tm_defaults: not called CC=4 SCAR=30.0
Pod documented
339 0 ▶ ; if ( $hints )
Branch: 1 branch
BranchTrueFalseTotal
if ($CGI::Builder::CgiAppAPI::hints) 0 0 0
340 0 ▶ { $s->isa('CGI::Application::Magic') && carp
Branch: 1 branch
BranchTrueFalseTotal
$s->isa("CGI::Application::Magic") and carp("You should not use 'CGI::Application::Magic' in your build") 0 0 0
341 qq(You should not use 'CGI::Application::Magic' in your build)
342
343 0 ▶ ; not($s->isa('CGI::Builder::Magic')) && carp
Branch: 1 branch
BranchTrueFalseTotal
$s->isa("CGI::Builder::Magic") or carp("You should include 'CGI::Builder::Magic' in your build") 0 0 0
344 qq(You should include 'CGI::Builder::Magic' in your build)
345
346 0 ; carp qq(Change 'tm_defaults' with 'tm_new_args')
347 }
348 ; require CGI::Builder::Magic
349 0 ; goto &CGI::Builder::Magic::tm_new_args
350 }
351  
352 ; sub request
353 0 ▶ { my $s = @_
Subroutine request: not called CC=4 SCAR=30.0
Pod documented
354 0 ▶ ; if ( $hints )
Branch: 1 branch
BranchTrueFalseTotal
if ($CGI::Builder::CgiAppAPI::hints) 0 0 0
355 0 ▶ { $s->isa('Apache::Application::Plus') && carp
Branch: 1 branch
BranchTrueFalseTotal
$s->isa("Apache::Application::Plus") and carp("You should not use 'Apache::Application::Plus' in your build") 0 0 0
356 qq(You should not use 'Apache::Application::Plus' in your build)
357
358 0 ▶ ; not($s->isa('Apache::CGI::Builder')) && carp
Branch: 1 branch
BranchTrueFalseTotal
$s->isa("Apache::CGI::Builder") or carp("You should include 'Apache::CGI::Builder' in your build") 0 0 0
359 qq(You should include 'Apache::CGI::Builder' in your build)
360
361 0 ; carp qq(Change 'request' with 'r')
362 }
363 ; require Apache::CGI::Builder
364 0 ; goto &Apache::CGI::Builder::r
365 }
366  
367 ; sub setup
368 6 ▶ { $_[0]->page_handler_map(start => \&dump_html)
Subroutine setup: called CC=1 SCAR=0.0
Pod undocumented
369 }
370
371 ; sub OH_init
372 33 ▶ { my $s = shift
Subroutine OH_init: called CC=5 SCAR=16.2
Pod undocumented
373 33 ▶ ; if ( $s->can('cgiapp_init') )
Branch: 1 branch
BranchTrueFalseTotal
if ($s->can("cgiapp_init")) 5 28 33
374 5 ▶ { $hints && carp
Branch: 1 branch
BranchTrueFalseTotal
$CGI::Builder::CgiAppAPI::hints and carp("Just change 'cgiapp_init' with 'OH_init'") 0 5 5
375 qq(Just change 'cgiapp_init' with 'OH_init')
376 5 ; $s->cgiapp_init(@_)
377 }
378 7 ▶ ; no strict 'refs'
Subroutine BEGIN: called CC=1 SCAR=0.0
379 7 ▶ ; if ( defined &{ref($s).'::setup'} )
Branch: 1 branch
BranchTrueFalseTotal
if (defined &{ref($s) . '::setup';}) 26 7 33
380 26 ▶ { $hints && carp
Branch: 1 branch
BranchTrueFalseTotal
$CGI::Builder::CgiAppAPI::hints and carp("Just change 'setup' with 'OH_init'") 0 26 26
381 qq(Just change 'setup' with 'OH_init')
382 }
383 33 ; $s->setup(@_)
384 }
385
386 ; sub OH_pre_process
387 27 ▶ { my $s = shift
Subroutine OH_pre_process: called CC=3 SCAR=11.0
Pod undocumented
388 27 ▶ ; if ( $s->can('cgiapp_prerun') )
Branch: 1 branch
BranchTrueFalseTotal
if ($s->can("cgiapp_prerun")) 5 22 27
389 5 ▶ { $hints && carp
Branch: 1 branch
BranchTrueFalseTotal
$CGI::Builder::CgiAppAPI::hints and carp("Just change 'cgiapp_prerun' with 'OH_pre_process'") 0 5 5
390 qq(Just change 'cgiapp_prerun' with 'OH_pre_process')
391 5 ; $s->cgiapp_prerun($s->page_name, @_)
392 }
393 }
394
395 ; sub OH_fixup
396 26 ▶ { my $s = shift
Subroutine OH_fixup: called CC=4 SCAR=14.1
Pod undocumented
397 26 ▶ ; if ( $s->can('cgiapp_postrun') )
Branch: 1 branch
BranchTrueFalseTotal
if ($s->can("cgiapp_postrun")) 3 23 26
398 3 ▶ { $hints && carp
Branch: 1 branch
BranchTrueFalseTotal
$CGI::Builder::CgiAppAPI::hints and carp("Change 'cgiapp_postrun' with 'OH_fixup' and use the 'page_content' instead of expecting it to be passed as an argument") 0 3 3
399 qq(Change 'cgiapp_postrun' with 'OH_fixup' )
400 . qq(and use the 'page_content' instead of expecting )
401 . qq(it to be passed as an argument)
402 3 ▶ ; $s->page_content( \ ( my $p = $s->page_content ) )
Branch: 1 branch
BranchTrueFalseTotal
unless ref $s->page_content 3 0 3
403 unless ref $s->page_content
404 3 ; $s->cgiapp_postrun($s->page_content, @_)
405 }
406 }
407
408 ; sub OH_cleanup
409 25 ▶ { my $s = shift
Subroutine OH_cleanup: called CC=3 SCAR=11.0
Pod undocumented
410 25 ▶ ; if ( $s->can('teardown') )
Branch: 1 branch
BranchTrueFalseTotal
if ($s->can("teardown")) 3 22 25
411 3 ▶ { $hints && carp
Branch: 1 branch
BranchTrueFalseTotal
$CGI::Builder::CgiAppAPI::hints and carp("Just change 'teardown' with 'OH_cleanup'") 0 3 3
412 qq(Just change 'teardown' with 'OH_cleanup')
413 3 ; $s->teardown(@_)
414 }
415 }
416  
417 ; sub cgi_new
418 4 ▶ { my $s = shift
Subroutine cgi_new: called CC=3 SCAR=11.0
Pod undocumented
419 4 ▶ ; if ( $s->can('cgiapp_get_query') )
Branch: 1 branch
BranchTrueFalseTotal
if ($s->can('cgiapp_get_query')) { } 1 3 4
420 1 ▶ { $hints && carp
Branch: 1 branch
BranchTrueFalseTotal
$CGI::Builder::CgiAppAPI::hints and carp("Just change 'cgiapp_get_query' with 'cgi_new'") 0 1 1
421 qq(Just change 'cgiapp_get_query' with 'cgi_new')
422 1 ; $s->cgiapp_get_query(@_)
423 }
424 else
425 { require CGI
426 3 ; CGI->new()
427 }
428 }
429  
430 ######### CAPTURE ############
431  
432 7 ; my $output
433 7 ; local *H
434  
435 ; sub start_capture # starts to capture output
436 0 ▶ { $hints && carp
Subroutine start_capture: not called CC=2 SCAR=17.9
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
$CGI::Builder::CgiAppAPI::hints and carp("Change both 'start_capture' and 'stop_capture' with the single 'capture()' method") 0 0 0
437 qq(Change both 'start_capture' and 'stop_capture' )
438 . qq(with the single 'capture()' method)
439 0 ; $output = ''
440 0 ; *H = '*'.select()
441 0 ; tie *H , 'CGI::Builder::Capt' , \ $output
442 }
443  
444 ; sub stop_capture # returns captured output
445 0 ▶ { $hints && carp
Subroutine stop_capture: not called CC=2 SCAR=17.9
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
$CGI::Builder::CgiAppAPI::hints and carp("Change both 'start_capture' and 'stop_capture' with the single 'capture()' method") 0 0 0
446 qq(Change both 'start_capture' and 'stop_capture' )
447 . qq(with the single 'capture()' method)
448 0 ; untie *H
449 0 ; $output
450 }
451  
452 ; package CGI::Builder::Capt
453  
454 ; sub TIEHANDLE
455 0 ▶ { bless \@_, shift
Subroutine TIEHANDLE: not called CC=1 SCAR=6.9
456 }
457
458 ; sub PRINT
459 0 ▶ { my $s = shift
Subroutine PRINT: not called CC=3 SCAR=24.8
460 0 ▶ ; ${$$s[0]} .= join $,||'', map{defined $_? $_ : ''} @_
Branch: 1 branch
BranchTrueFalseTotal
defined $_ ? : 0 0 0
Condition0%0/2
$, || ''
l!l
00
MC/DC0%0/1
$, || ''
$,
Truth table0%0/2
A
A= $,
Aresult
11
00
461 }
462
463 7 ; 1
464  
465 __END__
↑ Summary