Hogan/Template.pm

filter: Statementstmt 87.6% 142 / 162 Branchbran 67.1% 47 / 70 Conditioncond 75.0% 51 / 68 MC/DCmcdc 58.9% 23 / 39 Subroutinesub 93.1% 27 / 29 Podpod 0.0% 0 / 22 totaltotal 74.3% 290 / 390 CC 69 SCAR 21.5
CC
69
Cov
80%
ep
22.3
create_specialized_partial
13.1
d
10.4
CRAP 8.6
↑ Summary Hogan/Compiler.pm »
1 package Text::Hogan::Template;
2 4 $Text::Hogan::Template::VERSION = '2.06';
3 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 4 ▶use Clone qw(clone);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 4 ▶use HTML::Escape qw(escape_html);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 4 ▶use Ref::Util qw( is_ref is_arrayref is_coderef is_hashref);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 4 ▶use Scalar::Util qw(looks_like_number);
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 149 ▶sub new {
Subroutine new: called CC=9 SCAR=22.5
Pod undocumented
12 149 my ($orig, $code_obj, $text, $compiler, $options) = @_;
13  
14 149 ▶ $code_obj ||= {};
Condition100%2/2
$code_obj ||= {}
l!l
1454
MC/DC100%1/1
$code_obj ||= {}
$code_obj
Truth table100%2/2
A
A= $code_obj
Aresult
11
00
15  
16 return bless {
17 r => $code_obj->{'code'} || (is_hashref($orig) && $orig->{'r'}),
18 c => $compiler,
19 buf => "",
20 options => $options || {},
21 text => $text || "",
22 partials => $code_obj->{'partials'} || {},
23 subs => $code_obj->{'subs'} || {},
24 149 ▶ numeric_string_as_string => !!$options->{'numeric_string_as_string'},
Condition76%13/17
$code_obj->{'code'} || is_hashref($orig) && $orig->{'r'}
l!l&&r!l&&!r
14504
is_hashref($orig) and $orig->{"r"}
!ll&&!rl&&r
400
$options || {}
l!l
1454
$text || ''
l!l
1445
$code_obj->{'partials'} || {}
l!l
1454
$code_obj->{'subs'} || {}
l!l
1454
ref $orig || $orig
l!l&&r!l&&!r
14540
MC/DC33%1/3
$code_obj->{'code'} || is_hashref($orig) && $orig->{'r'}
$code_obj->{'code'} is_hashref($orig) $orig->{"r"}
MC/DC100%1/1
$options || {}
$options
MC/DC100%1/1
$text || ''
$text
MC/DC100%1/1
$code_obj->{'partials'} || {}
$code_obj->{'partials'}
MC/DC100%1/1
$code_obj->{'subs'} || {}
$code_obj->{'subs'}
MC/DC0%0/2
ref $orig || $orig
ref $orig $orig
Truth table50%2/4
A || B and C
A= $code_obj->{'code'}B= is_hashref($orig)C= $orig->{"r"}
ABCresult
1XX1
0111
00X0
0100
Truth table100%2/2
A
A= $options
Aresult
11
00
Truth table100%2/2
A
A= $text
Aresult
11
00
Truth table100%2/2
A
A= $code_obj->{'partials'}
Aresult
11
00
Truth table100%2/2
A
A= $code_obj->{'subs'}
Aresult
11
00
Truth table66%2/3
A || B
A= ref $origB= $orig
ABresult
1X1
011
000
25 }, ref($orig) || $orig;
26 }
27  
28 163 ▶sub r {
Subroutine r: called CC=2 SCAR=7.6
Pod undocumented
29 163 my ($self, $context, $partials, $indent) = @_;
30  
31 163 ▶ if ($self->{'r'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"r"}) 163 0 163
32 163 return $self->{'r'}->($self, $context, $partials, $indent);
33 }
34  
35 0 return "";
36 }
37  
38 117 ▶sub v {
Subroutine v: called CC=2 SCAR=7.2
Pod undocumented
39 117 my ($self, $str) = @_;
40 117 ▶ return escape_html($str // "");
Condition50%1/2
$str // ""
l!l
1170
MC/DC0%0/1
$str // ""
$str
Truth table50%1/2
A
A= $str
Aresult
11
00
41 }
42  
43 22 ▶sub t {
Subroutine t: called CC=2 SCAR=7.2
Pod undocumented
44 22 my ($self, $str) = @_;
45 22 ▶ return defined($str) ? $str : "";
Branch: 1 branch
BranchTrueFalseTotal
defined $str ? : 22 0 22
46 }
47  
48 147 ▶sub render {
Subroutine render: called CC=2 SCAR=6.9
Pod undocumented
49 147 my ($self, $context, $partials, $indent) = @_;
50 147 ▶ return $self->ri([ $context ], $partials || {}, $indent);
Condition100%2/2
$partials || {}
l!l
27120
MC/DC100%1/1
$partials || {}
$partials
Truth table100%2/2
A
A= $partials
Aresult
11
00
51 }
52  
53 163 ▶sub ri {
Subroutine ri: called CC=1 SCAR=0.0
Pod undocumented
54 163 my ($self, $context, $partials, $indent) = @_;
55 163 return $self->r($context, $partials, $indent);
56 }
57  
58 16 ▶sub ep {
Subroutine ep: called CC=12 SCAR=31.0
Pod undocumented
59 16 my ($self, $symbol, $partials) = @_;
60 16 my $partial = $self->{'partials'}{$symbol};
61  
62 # check to see that if we've instantiated this partial before
63 16 my $template = $partials->{$partial->{'name'}};
64 16 ▶ if ($partial->{'instance'} && $partial->{'base'} eq $template) {
Branch: 1 branch
BranchTrueFalseTotal
if ($partial->{"instance"} and $partial->{"base"} eq $template) 0 16 16
Condition33%1/3
$partial->{"instance"} and $partial->{"base"} eq $template
!ll&&!rl&&r
1600
MC/DC0%0/2
$partial->{"instance"} and $partial->{"base"} eq $template
$partial->{"instance"} $partial->{"base"} eq $template
Truth table33%1/3
A and B
A= $partial->{"instance"}B= $partial->{"base"} eq $template
ABresult
0X0
100
111
65 0 return $partial->{'instance'};
66 }
67  
68 16 ▶ if (! is_ref($template) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (is_ref($template)) 16 0 16
69 16 ▶ die "No compiler available" unless $self->{'c'};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"c"} 0 16 16
70
71 16 $template = $self->{'c'}->compile($template, $self->{'options'});
72 }
73  
74 16 ▶ return undef unless $template;
Branch: 1 branch
BranchTrueFalseTotal
unless $template 0 16 16
75  
76 16 $self->{'partials'}{$symbol}{'base'} = $template;
77  
78 16 ▶ if ($partial->{'subs'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($partial->{"subs"}) 16 0 16
79 # make sure we consider parent template now
80 16 ▶ $partials->{'stack_text'} ||= {};
Condition100%2/2
$partials->{"stack_text"} ||= {}
l!l
214
MC/DC100%1/1
$partials->{"stack_text"} ||= {}
$partials->{"stack_text"}
Truth table100%2/2
A
A= $partials->{"stack_text"}
Aresult
11
00
81  
82 16 for my $key (sort keys %{ $partial->{'subs'} }) {
83 0 ▶ if (!$partials->{'stack_text'}{$key}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($partials->{"stack_text"}{$key}) 0 0 0
84 $partials->{'stack_text'}{$key} =
85 $self->{'active_sub'} && $partials->{'stack_text'}{$self->{'active_sub'}}
86 ? $partials->{'stack_text'}{$self->{'active_sub'}}
87 0 ▶ : $self->{'text'};
Branch: 1 branch
BranchTrueFalseTotal
$self->{'active_sub'} && $partials->{'stack_text'}{$self->{'active_sub'}} ? : 0 0 0
Condition0%0/3
$self->{"active_sub"} and $partials->{"stack_text"}{$self->{"active_sub"}}
!ll&&!rl&&r
000
MC/DC0%0/2
$self->{"active_sub"} and $partials->{"stack_text"}{$self->{"active_sub"}}
$self->{"active_sub"} $partials->{"stack_text"}{$self->{"active_sub"}}
Truth table0%0/3
A and B
A= $self->{"active_sub"}B= $partials->{"stack_text"}{$self->{"active_sub"}}
ABresult
0X0
100
111
88 }
89 }
90 16 $template = create_specialized_partial($template, $partial->{'subs'}, $partial->{'partials'}, $self->{'stack_subs'}, $self->{'stack_partials'}, $self->{'stack_text'});
91 }
92 16 $self->{'partials'}{$symbol}{'instance'} = $template;
93  
94 16 return $template;
95 }
96  
97 # tries to find a partial in the current scope and render it
98 16 ▶sub rp {
Subroutine rp: called CC=2 SCAR=7.1
Pod undocumented
99 16 my ($self, $symbol, $context, $partials, $indent) = @_;
100  
101 16 ▶ my $partial = $self->ep($symbol, $partials) or return "";
Branch: 1 branch
BranchTrueFalseTotal
my $partial = $self->ep($symbol, $partials) or return "" 16 0 16
102  
103 16 return $partial->ri($context, $partials, $indent);
104 }
105  
106 # render a section
107 37 ▶sub rs {
Subroutine rs: called CC=3 SCAR=11.0
Pod undocumented
108 37 my ($self, $context, $partials, $section) = @_;
109 37 my $tail = $context->[-1];
110 37 ▶ if (! is_arrayref($tail) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (is_arrayref($tail)) 29 8 37
111 29 $section->($context, $partials, $self);
112 29 return;
113 }
114  
115 8 for my $t (@$tail) {
116 27 push @$context, $t;
117 27 $section->($context, $partials, $self);
118 27 pop @$context;
119 }
120 }
121  
122 # maybe start a section
123 77 ▶sub s {
Subroutine s: called CC=9 SCAR=22.0
Pod undocumented
124 77 my ($self, $val, $ctx, $partials, $inverted, $start, $end, $tags) = @_;
125 77 my $pass;
126  
127 77 ▶ return 0 if (is_arrayref($val)) && !@$val;
Branch: 1 branch
BranchTrueFalseTotal
if is_arrayref($val) and not @$val 3 74 77
Condition100%3/3
is_arrayref($val) and not @$val
!ll&&!rl&&r
6593
MC/DC100%2/2
is_arrayref($val) and not @$val
is_arrayref($val) not @$val
Truth table100%3/3
A and not(B)
A= is_arrayref($val)B= not @$val
ABresult
0X0
100
111
128  
129 74 ▶ if (is_coderef($val)) {
Branch: 1 branch
BranchTrueFalseTotal
if (is_coderef($val)) 6 68 74
130 6 $val = $self->ms($val, $ctx, $partials, $inverted, $start, $end, $tags);
131 }
132  
133 74 $pass = !!$val;
134  
135 74 ▶ if (!$inverted && $pass && $ctx) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $inverted and $pass and $ctx) 37 37 74
Condition83%5/6
not $inverted and $pass and $ctx
!ll&&!rl&&r
37037
not $inverted and $pass
!ll&&!rl&&r
261137
MC/DC66%2/3
not $inverted and $pass and $ctx
not $inverted $pass $ctx
Truth table75%3/4
not(A) and B and C
A= not $invertedB= $passC= $ctx
ABCresult
0XX0
10X0
1100
1111
136 37 ▶ push @$ctx, (is_arrayref($val) || is_hashref($val)) ? $val : $ctx->[-1];
Branch: 1 branch
BranchTrueFalseTotal
is_arrayref($val) || is_hashref($val) ? : 19 18 37
Condition100%3/3
is_arrayref($val) or is_hashref($val)
l!l&&r!l&&!r
81118
MC/DC100%2/2
is_arrayref($val) or is_hashref($val)
is_arrayref($val) is_hashref($val)
Truth table100%3/3
A or B
A= is_arrayref($val)B= is_hashref($val)
ABresult
1X1
011
000
137 }
138  
139 74 return $pass;
140 }
141  
142 # find values with dotted names
143 37 ▶sub d {
Subroutine d: called CC=10 SCAR=23.4
Pod undocumented
144 37 my ($self, $key, $ctx, $partials, $return_found) = @_;
145 37 my $found;
146  
147 # JavaScript split is super weird!!
148 #
149 # GOOD:
150 # > "a.b.c".split(".")
151 # [ 'a', 'b', 'c' ]
152 #
153 # BAD:
154 # > ".".split(".")
155 # [ '', '' ]
156 #
157 37 ▶ my @names = $key eq '.' ? ( '' ) x 2 : split /\./, $key;
Branch: 1 branch
BranchTrueFalseTotal
$key eq '.' ? : 23 14 37
158  
159 37 my $val = $self->f($names[0], $ctx, $partials, $return_found);
160  
161 37 my $cx;
162  
163 37 ▶ if ($key eq '.' && is_arrayref($ctx->[-2])) {
Branch: 1 branch
BranchTrueFalseTotal
if ($key eq '.' and is_arrayref($ctx->[-2])) { } 23 14 37
Condition66%2/3
$key eq "." and is_arrayref($ctx->[-2])
!ll&&!rl&&r
14023
MC/DC50%1/2
$key eq "." and is_arrayref($ctx->[-2])
$key eq "." is_arrayref($ctx->[-2])
Truth table66%2/3
A and B
A= $key eq "."B= is_arrayref($ctx->[-2])
ABresult
0X0
100
111
164 23 $val = $ctx->[-1];
165 }
166 else {
167 14 for my $name (@names[1..$#names] ) {
168 30 $found = find_in_scope($name, $val);
169 30 ▶ if (defined $found) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $found) { } 21 9 30
170 21 $cx = $val;
171 21 $val = $found;
172 }
173 else {
174 9 $val = "";
175 }
176 }
177 }
178  
179 37 ▶ return 0 if $return_found && !$val;
Branch: 1 branch
BranchTrueFalseTotal
if $return_found and not $val 4 33 37
Condition100%3/3
$return_found and not $val
!ll&&!rl&&r
2944
MC/DC100%2/2
$return_found and not $val
$return_found not $val
Truth table100%3/3
A and not(B)
A= $return_foundB= not $val
ABresult
0X0
100
111
180  
181 33 ▶ if (!$return_found && is_coderef($val)) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $return_found and is_coderef($val)) 0 33 33
Condition66%2/3
not $return_found and is_coderef($val)
!ll&&!rl&&r
4290
MC/DC0%0/2
not $return_found and is_coderef($val)
not $return_found is_coderef($val)
Truth table66%2/3
not(A) and B
A= not $return_foundB= is_coderef($val)
ABresult
0X0
100
111
182 0 push @$ctx, $cx;
183 0 $val = $self->mv($val, $ctx, $partials);
184 0 pop @$ctx;
185 }
186  
187 33 return $self->_check_for_num($val);
188 }
189  
190 # handle numerical interpolation for decimal numbers "properly"...
191 #
192 # according to the mustache spec 1.210 should render as 1.21
193 #
194 # unless the optional numeric_string_as_string was passed
195 219 ▶sub _check_for_num {
Subroutine _check_for_num: called CC=3 SCAR=11.0
196 219 my $self = shift;
197 219 my $val = shift;
198 219 ▶ return $val if ($self->{'numeric_string_as_string'});
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"numeric_string_as_string"} 1 218 219
199  
200 218 ▶ $val += 0 if looks_like_number($val);
Branch: 1 branch
BranchTrueFalseTotal
if &looks_like_number($val) 88 130 218
201  
202 218 return $val;
203 }
204  
205 # find values with normal names
206 216 ▶sub f {
Subroutine f: called CC=8 SCAR=20.8
Pod undocumented
207 216 my ($self, $key, $ctx, $partials, $return_found) = @_;
208 216 my ( $val, $found ) = ( 0 );
209  
210 216 ▶ for (my $j = $#$ctx; $j >= 0; $j--) {
Branch: 1 branch
BranchTrueFalseTotal
if ($j >= 0) 344 30 374
211 344 my $v = $ctx->[$j];
212 344 ▶ next unless ref($v) eq 'HASH' && defined($val = $v->{$key});
Branch: 1 branch
BranchTrueFalseTotal
unless ref $v eq "HASH" and defined($val = $v->{$key}) 158 186 344
Condition100%3/3
ref $v eq "HASH" and defined($val = $v->{$key})
!ll&&!rl&&r
58100186
MC/DC100%2/2
ref $v eq "HASH" and defined($val = $v->{$key})
ref $v eq "HASH" defined($val = $v->{$key})
Truth table100%3/3
A and B
A= ref $v eq "HASH"B= defined($val = $v->{$key})
ABresult
0X0
100
111
213  
214 186 $found = 1;
215 186 last;
216 }
217  
218 216 ▶ return $return_found ? 0 : "" unless $found;
Branch: 2 branches
BranchTrueFalseTotal
unless $found 30 186 216
$return_found ? : 4 26 30
219  
220 186 ▶ if (!$return_found && is_coderef($val)) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $return_found and is_coderef($val)) 8 178 186
Condition100%3/3
not $return_found and is_coderef($val)
!ll&&!rl&&r
731058
MC/DC100%2/2
not $return_found and is_coderef($val)
not $return_found is_coderef($val)
Truth table100%3/3
not(A) and B
A= not $return_foundB= is_coderef($val)
ABresult
0X0
100
111
221 8 $val = $self->mv($val, $ctx, $partials);
222 }
223  
224 186 return $self->_check_for_num($val);
225 }
226  
227 # higher order templates
228 5 ▶sub ls {
Subroutine ls: called CC=1 SCAR=0.0
Pod undocumented
229 5 my ($self, $func, $cx, $ctx, $partials, $text, $tags) = @_;
230 5 my $old_tags = $self->{'options'}{'delimiters'};
231  
232 5 $self->{'options'}{'delimiters'} = $tags;
233 5 $self->b($self->ct($func->($text), $cx, $partials));
234 5 $self->{'options'}{'delimiters'} = $old_tags;
235  
236 5 return 0;
237 }
238  
239 # compile text
240 13 ▶sub ct {
Subroutine ct: called CC=2 SCAR=7.1
Pod undocumented
241 13 my ($self, $text, $cx, $partials) = @_;
242  
243 die "Lambda features disabled"
244 13 ▶ if $self->{'options'}{'disable_lambda'};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"options"}{"disable_lambda"} 0 13 13
245  
246 13 return $self->{'c'}->compile($text, $self->{'options'})->render($cx, $partials);
247 }
248  
249 # template result buffering
250 466 ▶sub b {
Subroutine b: called CC=1 SCAR=0.0
Pod undocumented
251 # this is called so frequently that it makes sense to avoid the unpacking
252 466 $_[0]{'buf'} .= $_[1];
253 # instead of
254 # my ($self, $s) = @_;
255 # $self->{'buf'} .= $s;
256 }
257  
258 163 ▶sub fl {
Subroutine fl: called CC=1 SCAR=0.0
Pod undocumented
259 163 my ($self) = @_;
260 163 my $r = $self->{'buf'};
261 163 $self->{'buf'} = "";
262 163 return $r;
263 }
264  
265 # method replace section
266 6 ▶sub ms {
Subroutine ms: called CC=5 SCAR=17.5
Pod undocumented
267 6 my ($self, $func, $ctx, $partials, $inverted, $start, $end, $tags) = @_;
268  
269 6 ▶ return 1 if $inverted;
Branch: 1 branch
BranchTrueFalseTotal
if $inverted 1 5 6
270  
271 my $text_source = ($self->{'active_sub'} && $self->{'subs_text'} && $self->{'subs_text'}{$self->{'active_sub'}})
272 ? $self->{'subs_text'}{$self->{'active_sub'}}
273 5 ▶ : $self->{'text'};
Branch: 1 branch
BranchTrueFalseTotal
$self->{'active_sub'} && $self->{'subs_text'} && $self->{'subs_text'}{$self->{'active_sub'}} ? : 0 5 5
Condition33%2/6
$self->{"active_sub"} and $self->{"subs_text"} and $self->{"subs_text"}{$self->{"active_sub"}}
!ll&&!rl&&r
500
$self->{"active_sub"} and $self->{"subs_text"}
!ll&&!rl&&r
500
MC/DC0%0/3
$self->{"active_sub"} and $self->{"subs_text"} and $self->{"subs_text"}{$self->{"active_sub"}}
$self->{"active_sub"} $self->{"subs_text"} $self->{"subs_text"}{$self->{"active_sub"}}
Truth table25%1/4
A and B and C
A= $self->{"active_sub"}B= $self->{"subs_text"}C= $self->{"subs_text"}{$self->{"active_sub"}}
ABCresult
0XX0
10X0
1100
1111
274  
275 5 my $s = substr($text_source,$start,($end-$start));
276  
277 5 $self->ls($func, $ctx->[-1], $ctx, $partials, $s, $tags);
278  
279 5 return 0;
280 }
281  
282 # method replace variable
283 8 ▶sub mv {
Subroutine mv: called CC=1 SCAR=0.0
Pod undocumented
284 8 my ($self, $func, $ctx, $partials) = @_;
285 8 my $cx = $ctx->[-1];
286 8 my $result = $func->($self,$cx);
287  
288 8 return $self->ct($result, $cx, $partials);
289 }
290  
291 0 ▶sub sub {
Subroutine sub: not called CC=2 SCAR=17.9
Pod undocumented
292 0 my ($self, $name, $context, $partials, $indent) = @_;
293 0 ▶ my $f = $self->{'subs'}{$name} or return;
Branch: 1 branch
BranchTrueFalseTotal
my $f = $self->{"subs"}{$name} or return 0 0 0
294  
295 0 $self->{'active_sub'} = $name;
296 0 $f->($context,$partials,$self,$indent);
297 0 $self->{'active_sub'} = 0;
298 }
299  
300 ################################################
301  
302 30 ▶sub find_in_scope {
Subroutine find_in_scope: called CC=2 SCAR=6.9
Pod undocumented
303 30 my ($key, $scope) = @_;
304  
305 30 ▶ return is_hashref($scope) ? $scope->{$key} : undef;
Branch: 1 branch
BranchTrueFalseTotal
is_hashref($scope) ? : 26 4 30
306 }
307  
308 16 ▶sub create_specialized_partial {
Subroutine create_specialized_partial: called CC=9 SCAR=25.7
Pod undocumented
309 16 my ($instance, $subs, $partials, $stack_subs, $stack_partials, $stack_text) = @_;
310  
311 16 my $Partial = clone($instance);
312 16 $Partial->{'buf'} = "";
313  
314 16 ▶ $stack_subs ||= {};
Condition100%2/2
$stack_subs ||= {}
l!l
115
MC/DC100%1/1
$stack_subs ||= {}
$stack_subs
Truth table100%2/2
A
A= $stack_subs
Aresult
11
00
315 16 $Partial->{'stack_subs'} = $stack_subs;
316 16 $Partial->{'subs_text'} = $stack_text;
317  
318 16 for my $key (sort keys %$subs) {
319 0 ▶ if (!$stack_subs->{$key}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($stack_subs->{$key}) 0 0 0
320 0 $stack_subs->{$key} = $subs->{$key};
321 }
322 }
323 16 for my $key (sort keys %$stack_subs) {
324 0 $Partial->{'subs'}{$key} = $stack_subs->{$key};
325 }
326  
327 16 ▶ $stack_partials ||= {};
Condition100%2/2
$stack_partials ||= {}
l!l
115
MC/DC100%1/1
$stack_partials ||= {}
$stack_partials
Truth table100%2/2
A
A= $stack_partials
Aresult
11
00
328 16 $Partial->{'stack_partials'} = $stack_partials;
329  
330 16 for my $key (sort keys %$partials) {
331 0 ▶ if (!$stack_partials->{$key}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($stack_partials->{$key}) 0 0 0
332 0 $stack_partials->{$key} = $partials->{$key};
333 }
334 }
335 16 for my $key (sort keys %$stack_partials) {
336 0 $Partial->{'partials'}{$key} = $stack_partials->{$key};
337 }
338  
339 16 return $Partial;
340 }
341  
342  
343 0 ▶sub coerce_to_string {
Subroutine coerce_to_string: not called CC=2 SCAR=17.9
Pod undocumented
344 0 my ($str) = @_;
345 0 ▶ return defined($str) ? $str : "";
Branch: 1 branch
BranchTrueFalseTotal
defined $str ? : 0 0 0
346 }
347  
348 4 1;
349  
350 __END__
↑ Summary Hogan/Compiler.pm »