| line |
true |
false |
branch |
|
21
|
0 |
12 |
if ($] < "5.006" and not defined &warnings::import) |
|
23
|
0 |
12 |
if $INC[-1] eq "." |
|
281
|
16 |
667 |
defined $args{'template_dir'} ? : |
|
|
675 |
8 |
defined $args{'auto_escape'} ? : |
|
|
9 |
674 |
defined $args{'trim_blocks'} ? : |
|
|
8 |
675 |
defined $args{'lstrip_blocks'} ? : |
|
|
1 |
682 |
defined $args{'block_start'} ? : |
|
|
1 |
682 |
defined $args{'block_end'} ? : |
|
|
1 |
682 |
defined $args{'var_start'} ? : |
|
|
1 |
682 |
defined $args{'var_end'} ? : |
|
|
0 |
683 |
defined $args{'comment_start'} ? : |
|
|
0 |
683 |
defined $args{'comment_end'} ? : |
|
297
|
0 |
7 |
unless defined $name |
|
298
|
1 |
6 |
unless ref $code eq "CODE" |
|
308
|
0 |
4 |
unless defined $name |
|
309
|
0 |
4 |
unless ref $code eq "CODE" |
|
319
|
0 |
11 |
unless defined $vars |
|
329
|
1 |
668 |
unless defined $vars |
|
340
|
1 |
25 |
if ($filename =~ /\.\./) |
|
345
|
0 |
25 |
if ('File::Spec'->file_name_is_absolute($filename)) { } |
|
353
|
2 |
23 |
unless open HPHANDY_FH, "< $path" |
|
357
|
23 |
0 |
defined $source ? : |
|
365
|
678 |
0 |
defined $filename ? : |
|
396
|
0 |
0 |
exists $self->{'_blocks'}{$1} ? : |
|
398
|
10 |
0 |
if $val eq $prev2 |
|
402
|
0 |
10 |
if ($val ne $prev) |
|
420
|
6 |
672 |
if ($source =~ s/\{%-?\s*extends\s+["']([^"']+)["']\s*-?%\}[ \t]*\n?//) |
|
430
|
0 |
16 |
if $a eq "" |
|
431
|
2 |
14 |
if ($a =~ /^(\w+)\s*=\s*(.+)$/) { } |
|
451
|
10 |
0 |
unless exists $self->{'_blocks'}{$name} |
|
462
|
1 |
6 |
if ($source =~ s/\{%-?\s*extends\s+["']([^"']+)["']\s*-?%\}[ \t]*\n?//) |
|
469
|
0 |
0 |
if exists $self->{'_macros'}{$mname} |
|
473
|
0 |
0 |
if $a eq "" |
|
474
|
0 |
0 |
if ($a =~ /^(\w+)\s*=\s*(.+)$/) { } |
|
498
|
1 |
6 |
unless (exists $self->{'_blocks'}{$name}) |
|
507
|
1 |
0 |
exists $self->{'_blocks'}{$1} ? : |
|
509
|
1 |
1 |
if $expanded eq $prev |
|
532
|
9 |
1 |
if (exists $self->{'_blocks'}{$1}) { } |
|
534
|
7 |
8 |
unless $changed |
|
548
|
697 |
0 |
defined $filename ? : |
|
551
|
8 |
689 |
if ($self->{'trim_blocks'}) |
|
555
|
8 |
689 |
if ($self->{'lstrip_blocks'}) |
|
587
|
9 |
1683 |
if ($tok->[0] eq "text" and $tok->[1] =~ /\Q$raw_ph\E/) |
|
620
|
52 |
1303 |
if ($var_pos < 0 and $block_pos < 0) |
|
627
|
479 |
824 |
if ($var_pos >= 0 and $block_pos < 0 || $var_pos <= $block_pos) { } |
|
630
|
0 |
479 |
if ($end < 0) |
|
634
|
37 |
442 |
if ($next > $pos) |
|
647
|
7 |
472 |
if $strip_left |
|
648
|
7 |
472 |
if $strip_right |
|
650
|
6 |
1 |
if ($strip_left and @tokens and $tokens[-1][0] eq "text") |
|
652
|
3 |
3 |
if $tokens[-1][1] eq "" |
|
657
|
6 |
473 |
if ($strip_right and $pos < $len) |
|
667
|
0 |
824 |
if ($end < 0) |
|
671
|
304 |
520 |
if ($next > $pos) |
|
675
|
2 |
302 |
if ($stmt_raw =~ /^-/) |
|
678
|
303 |
1 |
if $text_before ne "" |
|
688
|
2 |
822 |
if ($rstrip_tag and $pos < $len) |
|
690
|
0 |
2 |
if $source =~ s/^(\s+)// |
|
698
|
0 |
16 |
if (not $rstrip_tag and $self->{'trim_blocks'} and $pos < $len and substr($source, $pos, 1) eq "\n") |
|
711
|
0 |
1256 |
unless defined $start |
|
719
|
378 |
1150 |
if ($type eq 'text') { } |
|
|
663 |
487 |
elsif ($type eq 'var') { } |
|
|
487 |
0 |
elsif ($type eq 'tag') { } |
|
725
|
20 |
643 |
if (ref $val eq 'HP::Handy::SafeString') { } |
|
|
15 |
628 |
elsif ($self->{'auto_escape'} and defined $val and not ref $val) { } |
|
731
|
656 |
7 |
defined $val ? : |
|
738
|
54 |
433 |
if ($stmt =~ /^set\s+(\w+)\s*=\s*(.+)$/) { } |
|
|
0 |
433 |
elsif ($stmt =~ /^set\s+(\w+)\s*$/) { } |
|
|
287 |
146 |
elsif ($stmt =~ /^if\s+(.+)$/) { } |
|
|
125 |
21 |
elsif ($stmt =~ /^for\s+(.+?)\s+in\s+(.+?)(?:\s+if\s+(.+))?$/) { } |
|
|
8 |
13 |
elsif ($stmt =~ /^include\s+["']([^"']+)["'](?:\s+ignore\s+missing)?$/) { } |
|
|
0 |
13 |
elsif ($stmt =~ /^(\w+)\s*\(([^)]*)\)$/ and exists $self->{'_macros'}{$1}) { } |
|
|
0 |
13 |
elsif ($stmt eq 'raw') { } |
|
|
13 |
0 |
elsif ($stmt =~ /^with(?:\s+(.+))?$/) { } |
|
|
0 |
0 |
elsif ($stmt =~ /^block\s+(\w+)$/) { } |
|
|
0 |
0 |
elsif ($stmt =~ /^end(if|for|block|macro|raw|with|set)/ or $stmt =~ /^(else|elif)/) { } |
|
772
|
1 |
7 |
if ($@) |
|
773
|
1 |
0 |
if $stmt =~ /ignore\s+missing/ |
|
774
|
0 |
1 |
unless $stmt =~ /ignore\s+missing/ |
|
776
|
8 |
0 |
if defined $inc_src |
|
795
|
13 |
0 |
if (defined $assigns) |
|
797
|
15 |
0 |
if ($pair =~ /^(\w+)\s*=\s*(.+)$/) |
|
810
|
0 |
0 |
if (exists $self->{'_blocks'}{$bname}) { } |
|
851
|
343 |
318 |
if ($type eq 'tag') { } |
|
852
|
8 |
335 |
if ($content =~ /^if\b/) { } |
|
|
295 |
40 |
elsif ($content eq 'endif') { } |
|
|
13 |
27 |
elsif ($depth == 1 and $content =~ /^elif\s+(.+)$/) { } |
|
|
16 |
11 |
elsif ($depth == 1 and $content eq 'else') { } |
|
858
|
287 |
8 |
if ($depth == 0) { } |
|
886
|
287 |
0 |
if @cur_body or not defined $cur_cond |
|
891
|
214 |
162 |
if (not defined $cond or $self->_eval_expr($cond, $vars)) |
|
913
|
193 |
195 |
if ($type eq "tag") |
|
914
|
25 |
168 |
if ($content =~ /^(?:for|if|block|macro|with)\b/) { } |
|
|
150 |
18 |
elsif ($content =~ /^end(?:for|if|block|macro|with)/) { } |
|
|
10 |
10 |
elsif ($depth == 1 and $content eq 'else') { } |
|
917
|
125 |
25 |
if ($depth == 0 and $content eq "endfor") |
|
923
|
10 |
243 |
if ($in_else) { } |
|
931
|
114 |
11 |
if (ref $iter eq 'ARRAY') { } |
|
|
5 |
6 |
elsif (ref $iter eq 'HASH') { } |
|
|
5 |
1 |
elsif (defined $iter) { } |
|
942
|
11 |
114 |
if (defined $cond_expr) |
|
947
|
20 |
15 |
if $self->_eval_expr($cond_expr, \%loop_vars) |
|
952
|
9 |
116 |
unless (@items) |
|
976
|
0 |
0 |
$idx > 0 ? : |
|
977
|
116 |
207 |
$idx == 0 ? : |
|
|
116 |
207 |
$idx == $#items ? : |
|
|
200 |
123 |
$idx % 2 == 0 ? : |
|
|
200 |
123 |
$idx % 2 == 0 ? : |
|
988
|
10 |
348 |
if ($loop_var =~ /^(\w+)\s*,\s*(\w+)$/) { } |
|
990
|
10 |
0 |
if (ref $item eq 'ARRAY') { } |
|
1006
|
0 |
0 |
unless defined $prev |
|
1009
|
0 |
0 |
$cv ne $pv ? : |
|
|
0 |
0 |
!(defined $cv && defined $pv) ? : |
|
|
0 |
0 |
!(defined $cv || defined $pv) ? : |
|
1040
|
24 |
18 |
if ($type eq "tag") |
|
1042
|
14 |
10 |
if (exists $ends{$content}) { } |
|
|
6 |
4 |
elsif (exists $opener_to_closer{$bare}) { } |
|
1044
|
13 |
1 |
if $depth == 0 |
|
1050
|
1 |
5 |
if (exists $ends{$closer}) |
|
1070
|
0 |
0 |
if $type eq "tag" and $content eq "endraw" |
|
1083
|
0 |
11 |
unless defined $macro |
|
1093
|
17 |
1 |
if ($idx < @arg_vals) { } |
|
|
1 |
0 |
elsif (defined $mdefaults[$idx]) { } |
|
1117
|
0 |
2681 |
unless defined $expr and $expr ne "" |
|
1120
|
1 |
2678 |
if $expr eq "none" or $expr eq "None" or $expr eq "undefined" |
|
1121
|
3 |
2675 |
if $expr eq "true" or $expr eq "True" |
|
1122
|
4 |
2671 |
if $expr eq "false" or $expr eq "False" |
|
1125
|
327 |
2344 |
if $expr =~ /^-?\d+(\.\d+)?$/ |
|
1128
|
1 |
2343 |
if ($expr =~ /^-(.+)$/ and not $1 =~ /^\d/) |
|
1130
|
1 |
0 |
defined $val ? : |
|
1134
|
203 |
2140 |
if ($expr =~ /^"((?:[^"\\]|\\.)*)"$/ or $expr =~ /^'((?:[^'\\]|\\.)*)'$/) |
|
1142
|
7 |
2133 |
if ($expr =~ /^\[(.+)\]$/) |
|
1148
|
1 |
2132 |
if ($expr =~ /^\{(.+)\}$/) |
|
1153
|
22 |
2110 |
if ($expr =~ /^range\(([^|]*)\)$/) |
|
1158
|
25 |
2085 |
if ($expr =~ /^(.+?)\s+if\s+(.+?)\s+else\s+(.+)$/) |
|
1160
|
14 |
11 |
$self->_eval_expr($cond, $vars) ? : |
|
1164
|
67 |
2018 |
if ($expr =~ /^not\s+(.+)$/) |
|
1165
|
14 |
53 |
$self->_eval_expr($1, $vars) ? : |
|
1169
|
4 |
2014 |
if ($expr =~ /^(.+?)\s+not\s+in\s+(.+)$/) |
|
1170
|
2 |
2 |
$TESTS{'in'}->($self->_eval_expr($1, $vars), $self->_eval_expr($2, $vars)) ? : |
|
1172
|
19 |
1995 |
if ($expr =~ /^(.+?)\s+in\s+(.+)$/) |
|
1177
|
12 |
1983 |
if ($expr =~ /^(.+?)\s+or\s+(.+)$/) |
|
1179
|
4 |
8 |
if $a |
|
1182
|
17 |
1966 |
if ($expr =~ /^(.+?)\s+and\s+(.+)$/) |
|
1184
|
10 |
7 |
$a ? : |
|
1190
|
241 |
1725 |
if ($expr =~ /^(.+?)\s*\|\s*(\w+)(.*)$/) |
|
1196
|
102 |
139 |
if ($rest =~ /^\s*\(/) { } |
|
|
35 |
104 |
elsif ($rest =~ /^\s*(\|.+)$/) { } |
|
1203
|
4 |
573 |
if (not $in_sq2 || $in_dq2 and $c eq "'") |
|
1204
|
4 |
569 |
if ($in_sq2 and $c eq "'") |
|
1205
|
82 |
487 |
if (not $in_sq2 || $in_dq2 and $c eq "\"") |
|
1206
|
82 |
405 |
if ($in_dq2 and $c eq "\"") |
|
1207
|
240 |
149 |
unless ($in_sq2 or $in_dq2) |
|
1208
|
102 |
138 |
if ($c eq '(') { } |
|
|
102 |
36 |
elsif ($c eq ')') { } |
|
1209
|
102 |
0 |
if ($depth2 == 0) |
|
1212
|
102 |
0 |
if ($found2 >= 0) |
|
1222
|
102 |
139 |
if ($fargs_str ne "") |
|
1227
|
241 |
0 |
$fn ? : |
|
1230
|
49 |
192 |
if ($remaining =~ s/^\s*\|\s*//) |
|
1237
|
107 |
1618 |
if ($expr =~ /^(.+?)\s*(==|!=|>=|<=|>|<)\s*(.+)$/) |
|
1241
|
0 |
107 |
unless defined $l and defined $r |
|
1243
|
6 |
8 |
$l == $r ? : |
|
|
4 |
4 |
$l eq $r ? : |
|
|
14 |
8 |
$numeric ? : |
|
|
22 |
85 |
if ($op eq "==") |
|
1244
|
2 |
4 |
$l != $r ? : |
|
|
6 |
3 |
$l ne $r ? : |
|
|
6 |
9 |
$numeric ? : |
|
|
15 |
70 |
if ($op eq "!=") |
|
1245
|
22 |
20 |
$l > $r ? : |
|
|
42 |
28 |
if ($op eq ">") |
|
1246
|
4 |
6 |
$l < $r ? : |
|
|
10 |
18 |
if ($op eq "<") |
|
1247
|
4 |
8 |
$l >= $r ? : |
|
|
12 |
6 |
if ($op eq ">=") |
|
1248
|
2 |
4 |
$l <= $r ? : |
|
|
6 |
0 |
if ($op eq "<=") |
|
1252
|
4 |
1614 |
if ($expr =~ m[^(.+?)\s*(\*\*|//)\s*(.+)$]) |
|
1256
|
4 |
0 |
if (defined $l and defined $r) |
|
1257
|
3 |
0 |
$r != 0 ? : |
|
|
3 |
1 |
if ($op eq "//") |
|
1258
|
1 |
0 |
if ($op eq "**") |
|
1269
|
2 |
6559 |
if (not $in_sq3 || $in_dq3 and $c eq "'") |
|
1270
|
2 |
6557 |
if ($in_sq3 and $c eq "'") |
|
1271
|
26 |
6531 |
if (not $in_sq3 || $in_dq3 and $c eq "\"") |
|
1272
|
26 |
6505 |
if ($in_dq3 and $c eq "\"") |
|
1273
|
44 |
6461 |
if $in_sq3 or $in_dq3 |
|
1274
|
27 |
6379 |
if ($c eq "(" or $c eq "[" or $c eq "{") |
|
1275
|
27 |
6301 |
if ($c eq ")" or $c eq "]" or $c eq "}") |
|
1276
|
499 |
5802 |
if $depth3 != 0 |
|
1277
|
59 |
5743 |
if ($c =~ m[^[+\-*/%~]$]) |
|
1278
|
1 |
58 |
if $ci == 0 |
|
1280
|
0 |
58 |
if $prev =~ m[^[+\-*/%~(]$] or $prev eq "" |
|
1281
|
0 |
12 |
if $c eq "*" and $ci + 1 < length $expr and substr($expr, $ci + 1, 1) eq "*" |
|
1282
|
0 |
1 |
if $c eq "/" and $ci + 1 < length $expr and substr($expr, $ci + 1, 1) eq "/" |
|
1287
|
58 |
1556 |
if ($op_pos > 0) |
|
1293
|
58 |
0 |
if (defined $l and defined $r) |
|
1294
|
26 |
32 |
if ($op_char eq "+") |
|
1295
|
26 |
0 |
$l =~ /^-?\d/ && $r =~ /^-?\d/ ? : |
|
1297
|
16 |
16 |
if ($op_char eq "~") |
|
1298
|
2 |
14 |
if ($op_char eq "-") |
|
1299
|
12 |
2 |
if ($op_char eq "*") |
|
1300
|
1 |
0 |
$r != 0 ? : |
|
|
1 |
1 |
if ($op_char eq "/") |
|
1301
|
1 |
0 |
$r != 0 ? : |
|
|
1 |
0 |
if ($op_char eq "%") |
|
1308
|
35 |
1521 |
if ($expr =~ /^\((.+)\)$/) |
|
1313
|
9 |
1512 |
if ($expr =~ /^(.+?)\s+is\s+not\b\s+(\w+)(?:\s+(.+))?$/) |
|
1316
|
0 |
9 |
defined $arg ? : |
|
1318
|
2 |
7 |
&$fn($val, $targ) ? : |
|
|
9 |
0 |
$fn ? : |
|
1320
|
134 |
1378 |
if ($expr =~ /^(.+?)\s+is\s+(\w+)(?:\s+(.+))?$/) |
|
1323
|
42 |
92 |
defined $arg ? : |
|
1325
|
63 |
71 |
&$fn($val, $targ) ? : |
|
|
134 |
0 |
$fn ? : |
|
1329
|
157 |
1221 |
if ($expr =~ /^(.+?)\.(\w+)(?:\(([^)]*)\))?$/) |
|
1332
|
0 |
157 |
if (defined $call_args) |
|
1336
|
0 |
0 |
$fn ? : |
|
1341
|
5 |
1216 |
if ($expr =~ /^(.+?)\[["'](\w+)["']\]$/) |
|
1347
|
12 |
1204 |
if ($expr =~ /^(.+?)\[(-?\d+)\]$/) |
|
1350
|
12 |
0 |
ref $obj eq 'ARRAY' ? : |
|
1354
|
5 |
1199 |
if ($expr =~ /^(.+?)\[(-?\d*):(-?\d*)\]$/) |
|
1357
|
0 |
5 |
unless ref $obj eq "ARRAY" |
|
1359
|
4 |
1 |
$s ne '' ? : |
|
1360
|
4 |
1 |
$e ne '' ? : |
|
1361
|
0 |
5 |
if $si < 0 |
|
1362
|
1 |
4 |
if $ei < 0 |
|
1363
|
0 |
5 |
if $si < 0 |
|
1364
|
0 |
5 |
if $ei > $len |
|
1369
|
11 |
1188 |
if ($expr =~ /^(\w+)\s*\(([^)]*)\)$/) |
|
1372
|
11 |
0 |
if (exists $self->{'_macros'}{$fname}) |
|
1376
|
0 |
0 |
if ($fname eq "range") |
|
1382
|
1178 |
10 |
if ($expr =~ /^(\w+)$/) |
|
1383
|
1150 |
28 |
exists $vars->{$expr} ? : |
|
1397
|
1 |
0 |
if ($pair =~ /^(.+?)\s*:\s*(.+)$/) |
|
1400
|
1 |
0 |
if defined $k |
|
1413
|
14 |
8 |
if (@args == 1) { } |
|
|
4 |
4 |
elsif (@args == 2) { } |
|
1416
|
0 |
22 |
if $step == 0 |
|
1418
|
20 |
2 |
if ($step > 0) { } |
|
1428
|
0 |
189 |
unless defined $obj |
|
1429
|
189 |
0 |
if (ref $obj eq "HASH") |
|
1430
|
188 |
1 |
exists $obj->{$attr} ? : |
|
1432
|
0 |
0 |
if (ref $obj eq "ARRAY") |
|
1433
|
0 |
0 |
$attr =~ /^-?\d+$/ ? : |
|
1443
|
1 |
155 |
unless defined $str and $str =~ /\S/ |
|
1451
|
4 |
677 |
if (not $in_sq || $in_dq and $ch eq "'") |
|
1452
|
4 |
673 |
if ($in_sq and $ch eq "'") |
|
1453
|
99 |
574 |
if (not $in_sq || $in_dq and $ch eq "\"") |
|
1454
|
99 |
475 |
if ($in_dq and $ch eq "\"") |
|
1455
|
275 |
184 |
unless ($in_sq or $in_dq) |
|
1456
|
1 |
274 |
if ($ch eq '(' or $ch eq '[' or $ch eq '{') { } |
|
|
1 |
273 |
elsif ($ch eq ')' or $ch eq ']' or $ch eq '}') { } |
|
|
42 |
460 |
elsif ($ch eq ',' and $depth == 0) { } |
|
1468
|
155 |
0 |
if $cur ne "" |
|
1477
|
0 |
26 |
unless defined $s |
|
1491
|
1 |
12 |
unless defined $val |
|
1492
|
0 |
12 |
if ref $val eq "SCALAR" and $$val == 1 |
|
1493
|
0 |
12 |
if ref $val eq "SCALAR" and $$val == 0 |
|
1494
|
2 |
10 |
if (ref $val eq "ARRAY") |
|
1497
|
1 |
9 |
if (ref $val eq "HASH") |
|
1502
|
6 |
3 |
if ($val =~ /^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/) |