Branch Coverage

blib/lib/Template/Sluz.pm
Criterion Covered Total %
branch 345 456 75.6


line true false branch
36 3 0 if (ref $v eq "ARRAY")
40 0 0 if (ref $v eq "HASH")
44 0 0 if (defined $v)
97 9 235 if (@_ == 1 and ref $_[0] eq 'HASH') { }
234 1 elsif (@_ % 2 == 0) { }
121 1 2 unless ($self->{'perl_file'})
127 1 2 if (defined $parent) { }
133 2 1 if ($parent_tpl)
169 2 0 if (@_)
181 0 1 unless (defined $open and defined $close)
185 0 1 if (length $open != 1 or length $close != 1)
189 0 1 if ($open eq $close)
215 0 80 unless (defined $needle and defined $haystack)
218 50 30 if (exists $haystack->{$needle})
227 0 53 unless (defined $arr)
228 10 43 if (ref $arr eq 'ARRAY') { }
43 0 elsif (ref $arr eq 'HASH') { }
229 0 10 unless ($elem =~ /^\d+$/u and $elem < @$arr)
232 9 34 unless (exists $arr->{$elem})
246 1 31 if (ref $str eq "ARRAY")
247 0 31 if (ref $str eq "HASH")
268 0 0 unless ($self->{'auto_escape'})
269 0 0 if (ref $val)
279 15 114 if (length $str and substr($str, 0, 1) eq $char)
294 0 23 if ($pos < 0)
298 18 5 if ($open_count == 1)
307 0 13 if ($pos < 0)
312 5 8 if ($open_count == $close_count)
326 196 0 if defined $_
333 42 153 if ($str eq $self->{'_tag_else'})
334 30 123 if ($str eq $self->{'_tag_if_close'})
335 70 53 if (index($str, $self->{'_tag_if'}) == 0 or index($str, $self->{'_tag_elseif'}) == 0)
430 4 0 if ($self->{'perl_file_dir'})
434 0 4 unless (length $tpl_file)
438 0 4 if ($tpl_file eq 'INLINE_TEMPLATE') { }
440 0 0 if (defined $c)
453 0 4 if ($tf and not -r $tf)
457 4 0 if ($tf)
459 0 4 unless open my $fh, "<", $tf
472 0 0 unless open my $fh, "<", $file
476 0 0 if ($idx < 0)
492 15 316 if (exists $self->{'_blocks_cache'}{$str})
507 44 272 if ($z < 0)
514 293 270 unless ($is_open or $is_closed)
516 162 131 if ($next_open < 0)
518 17 276 if ($next_close < 0)
519 7 286 if ($next_open < $next_close) { }
530 288 270 if ($is_open)
532 34 254 if ($i > 0) { }
538 288 0 if ($i + 1 < $slen) { }
544 2 286 if ($chk =~ /$self->{'_space_guard_re'}/u)
545 23 265 if ($next_c eq "*")
548 30 528 if ($is_open and $has_len) { }
270 258 elsif ($is_closed) { }
556 58 212 if (index($block, $tag_if) == 0) { }
39 173 elsif (index($block, $tag_foreach) == 0) { }
7 166 elsif (index($block, $tag_literal) == 0) { }
560 104 166 if ($matched_block)
563 230 1847 if (substr($str, $j, 1) eq $cd)
567 103 127 if ($oc == $cc)
575 270 0 if (length $block)
580 23 535 if ($is_comment)
582 0 23 unless (defined $end)
590 7 13 if ($pre_nl and $post_nl and $after < $slen)
599 70 246 if ($start < $slen)
614 4 366 if ($prev_is_if)
616 2 2 if ($blocks[$i - 1][0] =~ /^\Q$tag_foreach\E.+?\}(.*)\Q$tag_foreach_close\E$/su)
617 1 1 substr($1, -1) eq "\n" ? :
619 3 1 if ($should_strip)
640 57 232 if ($out)
643 0 62 unless length $block
644 42 20 if (ord $block != $od_ord)
650 13 1 if (substr($block, 0, 2) eq $var_tag and index($block, "|") == -1 and $block =~ /$var_re/u)
654 9 4 if (index($var, '.') == -1) { }
659 0 13 if (ref $val eq 'ARRAY') { }
0 13 elsif (ref $val eq 'HASH') { }
13 0 elsif (defined $val) { }
661 1 12 $self->{'auto_escape'} ? :
666 6 1 if (substr($block, 0, $self->{'_tag_if_len'}) eq $self->{'_tag_if'} and substr($block, -$self->{'_tag_if_close_len'}) eq $self->{'_tag_if_close'})
680 0 272 unless length $block
681 52 220 if (ord $block != $od_ord)
686 49 57 if (substr($block, 0, 2) eq $var_tag and index($block, "|") == -1 and $block =~ /$var_re/u)
690 45 4 if (index($var, '.') == -1) { }
695 4 45 if (ref $val eq 'ARRAY') { }
0 45 elsif (ref $val eq 'HASH') { }
38 7 elsif (defined $val) { }
697 5 33 $self->{'auto_escape'} ? :
701 44 127 if (substr($block, 0, $self->{'_tag_if_len'}) eq $self->{'_tag_if'} and substr($block, -$self->{'_tag_if_close_len'}) eq $self->{'_tag_if_close'})
724 60 80 if (substr($str, 0, 2) eq "$od\$" and $str =~ /$self->{'_re_var_full'}/u)
729 0 80 if (substr($str, 0, $self->{'_tag_if_len'}) eq $self->{'_tag_if'} and substr($str, -$self->{'_tag_if_close_len'}) eq $self->{'_tag_if_close'})
735 39 41 if (substr($str, 0, $self->{'_tag_foreach_len'}) eq $self->{'_tag_foreach'} and $str =~ /$self->{'_re_foreach'}/u)
740 9 32 if (substr($str, 0, $self->{'_tag_include_len'}) eq $self->{'_tag_include'})
745 7 25 if (substr($str, 0, $self->{'_tag_literal_len'}) eq $self->{'_tag_literal'} and $str =~ /$self->{'_re_literal'}/u)
750 21 4 if ($str =~ /$self->{'_re_expr'}/u)
755 3 1 if (ord substr($str, -1) != $cd_ord)
775 0 60 if (index($str, "|") == -1)
778 0 0 if (index($str, '.') == -1) { }
783 0 0 if (ref $ret eq "ARRAY")
784 0 0 if (ref $ret eq "HASH")
785 0 0 $self->{'auto_escape'} ? :
0 0 if (defined $ret)
789 60 0 if ($str =~ /(.+?)\|(.*)/u)
797 6 54 if ($is_nothing and $is_default) { }
3 51 elsif (not $is_nothing and $is_default) { }
801 6 0 if (defined $ret)
806 6 45 if ($is_nothing)
821 19 30 if ($func eq "escape")
822 7 42 if ($func eq "noescape")
826 15 34 if (length $param_str)
840 12 37 unless (defined $cref)
842 2 10 if (defined &{"main::$func";}) { }
6 4 elsif (defined &{$func;}) { }
4 0 elsif (defined &{"CORE::$func";}) { }
849 0 49 unless ($cref)
855 0 49 if ($@)
860 1 8 if ($self->{'auto_escape'} and not $seen_noescape and not $seen_escape)
868 0 0 if (ref $ret eq "ARRAY")
869 0 0 if (ref $ret eq "HASH")
870 0 0 $self->{'auto_escape'} ? :
0 0 if (defined $ret)
879 12 56 if (exists $self->{'_if_rules_cache'}{$str}) { }
888 32 24 if ($is_simple) { }
907 16 70 (index($raw, '$') == -1) ? :
910 57 29 if ($res)
915 13 44 $cached ? :
940 6 56 if defined $b->[2]
942 0 56 if (not length $bs) { }
16 40 elsif (ord $bs != $od_ord) { }
30 10 elsif (substr($bs, 0, 2) eq "$od\$" and index($bs, '|') == -1 and $bs =~ /$self->{'_re_var_simple'}/u) { }
6 4 elsif (substr($bs, 0, $self->{'_tag_if_len'}) eq $self->{'_tag_if'} and substr($bs, -$self->{'_tag_if_close_len'}) eq $self->{'_tag_if_close'}) { }
960 2 37 if (not defined $src) { }
1 68 elsif (ref $src ne 'ARRAY' and ref $src ne 'HASH') { }
970 9 30 defined $oval ? :
986 9 30 if (defined $oval)
990 2 37 if $need_first
991 2 37 if $need_first
992 1 38 if $need_last
993 1 38 if $need_last
994 1 38 if $need_index
995 1 38 if $need_index
1002 35 4 if (ref $src eq 'ARRAY') { }
4 0 elsif (ref $src eq 'HASH') { }
1005 6 82 if ($need_first)
1006 2 4 $idx == 0 ? :
1007 2 4 $idx == 0 ? :
1009 3 85 if ($need_last)
1010 1 2 $idx == $last ? :
1011 1 2 $idx == $last ? :
1013 3 85 if ($need_index)
1017 16 72 if (defined $oval) { }
1029 34 98 if ($type == 0) { }
68 30 elsif ($type == 1) { }
18 12 elsif ($type == 2) { }
0 12 elsif ($type == -1) { }
1034 56 12 if (index($var, '.') == -1) { }
1039 0 68 if (ref $val eq 'ARRAY') { }
0 68 elsif (ref $val eq 'HASH') { }
68 0 elsif (defined $val) { }
1041 3 65 $self->{'auto_escape'} ? :
1058 0 11 if ($need_first)
1059 0 0 $idx == 0 ? :
1060 0 0 $idx == 0 ? :
1062 0 11 if ($need_last)
1063 0 0 $idx == $last ? :
1064 0 0 $idx == $last ? :
1066 0 11 if ($need_index)
1070 6 5 if (defined $oval) { }
1082 15 17 if ($type == 0) { }
17 0 elsif ($type == 1) { }
0 0 elsif ($type == 2) { }
0 0 elsif ($type == -1) { }
1087 17 0 if (index($var, '.') == -1) { }
1092 0 17 if (ref $val eq 'ARRAY') { }
0 17 elsif (ref $val eq 'HASH') { }
17 0 elsif (defined $val) { }
1094 2 15 $self->{'auto_escape'} ? :
1110 23 29 if ($tpl_exists[$i]) { }
1115 23 29 if ($ks_exists[$i]) { }
1132 9 0 if ($self->{'perl_file_dir'})
1139 8 1 if ($key eq "file")
1142 1 0 if (defined $res) { }
1149 0 9 unless (-f $inc_tpl and -r $inc_tpl)
1156 0 9 unless open my $fh, "<", $inc_tpl
1174 5 16 unless ($str =~ /["\d\$\(]/u)
1183 14 2 if (defined $ret and !ref($ret) || ref $ret eq '') { }
1189 2 14 if ($err or not $valid)
1204 13 84 if (index($str, "\$") == -1)
1208 21 63 if (exists $self->{'_convert_cache'}{$str})
1218 3 60 if (index($str, "[") != -1)
1234 1 5 if ($p =~ /^\d+$/u) { }
1246 19 154 if ($str =~ /^-?\d+(?:\.\d+)?$/u)
1248 1 153 unless (length $str)
1252 10 143 if ($first == 39 and $last == 39)
1254 10 0 if (index($tmp, "'") == -1)
1257 16 127 if ($first == 34 and $last == 34)
1259 13 3 if (index($tmp, "\$") == -1 and index($tmp, "\"") == -1)
1262 80 14 if ($str =~ /^(!?)\$__S->\{sluz_pfx_(\w+)\}$/u and exists $self->{'tpl_vars'}{$2})
1263 3 77 $1 ? :
1266 3 0 if ($str =~ /^(!?)(\w+)$/u and exists $self->{'tpl_vars'}{$2})
1267 0 3 $1 ? :
1277 0 173 if (index($str, "===") != -1)
1282 123 50 if (defined $opt)
1292 13 37 if ($vsub)
1298 37 0 unless (defined $sub)
1301 1 36 if ($@)
1309 36 1 if ($sub)
1312 33 3 unless ($@)
1325 1 3 if ($@)
1330 1 3 if ($@)
1353 0 10 if ($self->{'inc_tpl_file'})
1356 0 10 exists $self->{'tpl_file_display'} ? :
1357 0 10 exists $self->{'tpl_line_offset'} ? :
1361 9 1 unless (length $tpl_file)
1364 0 1 if ($pos < 0 or not defined $str)
1370 0 4 if (substr($str, $i, 1) eq "\n")
1374 1 3 if ($pos == $i)
1377 0 0 if ($pos == length $str)
1385 8 1 if ($str =~ /\s(file=)(['"].+?['"])/u)
1392 1 0 if ($str =~ /\s(['"].+?['"])/u)
1416 30 130 if (index($item, $tif_prefix) == 0)
1417 30 130 if ($item eq $tifc_tag)
1420 116 44 if ($nested == 1)
1422 6 110 if $item eq $tifc_tag
1431 79 81 if ($tmp[$i])
1433 55 24 if ($i != $num - 1)
1441 79 81 if ($tmp[$i]) { }
1442 55 24 unless ($first)
1450 0 24 if (@conds != @payloads)