Branch Coverage

blib/lib/Text/BasicTemplate.pm
Criterion Covered Total %
branch 343 554 61.9


line true false branch
725 7 0 unless defined $$self{'use_full_cond_cache'}
726 7 0 unless defined $$self{'use_cond2rpn_cache'}
727 7 0 unless defined $$self{'use_dynroutine_arg_cache'}
729 7 0 unless defined $$self{'taint_enabled'}
736 7 0 unless (defined $$self{'use_file_cache'})
741 7 0 unless defined $$self{'use_flock'}
761 7 0 unless defined $$self{'list_delimiter'}{'__default'}
763 7 0 unless defined $$self{'hash_delimiter'}{'__default'}
765 7 0 unless defined $$self{'hash_specifier'}{'__default'}
773 7 0 unless ref $$self{'pragma_enable'} eq 'HASH'
774 7 0 unless ref $$self{'pragma_functions'} eq 'HASH'
777 7 0 unless defined $$self{'compatibility_mode_0x'}
780 7 0 if ($$self{'compatibility_mode_0x'})
783 6 1 unless defined $$self{'simple_ssi'}
784 7 0 if ($$self{'simple_ssi'})
791 0 7 unless (defined $$self{'pragma_enable'}{'bt_include'})
792 0 0 unless ($$self{'taint_enabled'})
868 145 587 if (ref $d eq 'HASH') { }
0 587 elsif (ref $d eq 'ARRAY') { }
587 0 elsif (not ref $d) { }
873 2 585 if ($$self{'compatibility_mode_0x'} and $d =~ /^([\w\.\-]+)=(.*)/s)
877 585 0 if (@dict) { }
888 145 0 if ($$self{'compatibility_mode_0x'})
892 0 145 if $$self{'max_parse_recursion'} and $$ovr{'_bt_recurse_count'} > $$self{'max_parse_recursion'}
896 0 145 if (ref $isrc eq 'ARRAY') { }
97 48 elsif (ref $isrc eq 'SCALAR') { }
48 0 elsif (not ref $isrc) { }
899 0 97 if ($$self{'use_scalarref_lexicon_cache'} and defined $$self{'lexicon_cache'}{$isrc}) { }
901 0 0 if $debug
905 0 97 if ($$self{'use_scalarref_lexicon_cache'})
910 0 48 if ($$self{'use_scalarref_lexicon_cache'} and defined $$self{'lexicon_cache'}{$isrc}) { }
914 0 48 unless ($tsrc = $self->load_from_file($isrc))
919 4 44 if ($$self{'use_scalarref_template_cache'})
926 145 0 if ($$self{'compatibility_mode_0x'})
931 20 125 if $$self{'strip_html_comments'}
932 20 125 if $$self{'strip_c_comments'} or $$self{'strip_cpp_comments'}
934 20 125 if $$self{'strip_cpp_comments'}
935 20 125 if $$self{'strip_perl_comments'}
936 20 125 if $$self{'condense_whitespace'}
937 145 0 if ($$self{'use_full_cond_cache'} == 1)
965 0 174 unless ref $ovr eq 'HASH'
966 0 174 unless ref $L eq 'ARRAY'
967 0 174 unless defined $start_pos and defined $end_pos and $end_pos >= $start_pos
968 0 174 if $end_pos < 0 or not @{$L;}
970 0 174 if $debug
971 0 174 if $debug
977 0 366 if $$lexeme[0] > $$self{'max_parse_recursion'}
979 0 366 if $debug
980 171 195 if $$lexeme[2]
981 195 171 unless ($$lexeme[2])
983 0 195 if $debug
987 38 133 if ($$lexeme[2] == 2) { }
84 49 elsif ($$lexeme[2] == 6) { }
988 0 38 if $debug
993 0 84 if $debug
999 45 88 if ($$lexeme[2] == 1 and $$lexeme[1] =~ /^%(else|(if|elsif)\s+([^%]+))%$/)
1002 7 38 if $1 eq 'else'
1003 0 45 if $debug
1004 29 16 if ($self->cond_evaluate($cond, $ovr)) { }
1005 0 29 if $debug
1018 17 60 if ($$L[$i1][0] == $$L[$i][0] and $$L[$i1][1] eq '%fi%') { }
11 49 elsif ($$L[$i1][0] == $$L[$i][0] and $$L[$i1][1] eq '%else%' or substr($$L[$i1][1], 0, 7) eq '%elsif ') { }
1045 29 0 if $s and ref $s eq 'SCALAR'
1053 0 16 if $debug
1064 0 16 if $1 and $1 eq 'fi'
1065 0 16 if $debug
1069 0 133 if $debug
1093 0 132 if $debug
1094 0 132 unless defined $cond
1099 1 131 if $$self{'use_full_cond_cache'} and $$self{'fullcond_cache'}{"$ovr\t$cond"}
1107 22 109 if ($$self{'use_cond2rpn_cache'} and $$self{'cond2rpn_cache'}{$cond}) { }
1108 0 22 if $debug
1118 0 109 if $debug
1122 0 3 if $debug
1126 0 3 if $debug
1128 0 109 if $debug
1138 0 190 if $debug
1144 190 0 if defined $operand
1151 6 184 if $unaryop
1152 82 108 if ($binop_leftover)
1156 82 108 if $binaryop
1158 0 190 if $debug
1162 0 109 if $binop_leftover
1164 109 0 if ($$self{'use_cond2rpn_cache'})
1172 216 94 if ($$_[0] == 2)
1173 2 214 if ($$_[1] eq 'cacheablething')
1185 1 130 unless @cstack
1187 0 130 if $debug
1189 0 130 if $debug
1193 0 94 if $debug
1196 0 94 if ($$n[0] != 2)
1204 0 94 unless @cstack
1207 7 87 if ($$n[0] == 4) { }
87 0 elsif ($$n[0] == 2) { }
1219 86 1 if ($$n[0] == 5) { }
1 0 elsif ($$n[0] == 4) { }
1239 0 130 if $debug
1242 130 0 if ($$self{'use_full_cond_cache'})
1245 128 2 if defined $$n[1]
1253 0 86 if $debug
1255 0 86 unless (defined $op)
1259 1 85 unless (defined $lvalue)
1263 0 85 unless (defined $operand)
1268 18 67 if ($op eq 'eq') { }
1 66 elsif ($op eq 'ne') { }
2 64 elsif ($op eq 'lt') { }
1 63 elsif ($op eq 'le') { }
2 61 elsif ($op eq 'gt') { }
3 58 elsif ($op eq 'ge') { }
2 56 elsif ($op eq '=~' and $$self{'enable_pattern_operator'}) { }
3 53 elsif ($op eq '!~' and $$self{'enable_pattern_operator'}) { }
5 48 elsif ($op eq '==') { }
2 46 elsif ($op eq '!=') { }
2 44 elsif ($op eq '<') { }
2 42 elsif ($op eq '<=') { }
1 41 elsif ($op eq '>') { }
1 40 elsif ($op eq '>=') { }
2 38 elsif ($op eq '<=>') { }
11 27 elsif ($op eq '&&' or $op eq 'and') { }
3 24 elsif ($op eq '||' or $op eq 'or') { }
1 23 elsif ($op eq '.') { }
1 22 elsif ($op eq 'x') { }
1 21 elsif ($op eq '+') { }
1 20 elsif ($op eq '-') { }
1 19 elsif ($op eq '*') { }
2 17 elsif ($op eq '/' and $operand) { }
1 16 elsif ($op eq 'div' and $operand) { }
1 15 elsif ($op eq 'mod' and $operand) { }
2 13 elsif ($op eq '**') { }
2 11 elsif ($op eq '^') { }
2 9 elsif ($op eq '&') { }
1 8 elsif ($op eq '|') { }
4 4 elsif ($op eq '<<') { }
4 0 elsif ($op eq '>>') { }
1350 0 8 if $debug
1352 0 8 if (not $op) { }
6 2 elsif ($op eq '!') { }
2 0 elsif ($op eq 'defined' or $op =~ /^defined\s+/) { }
1399 0 254 if $debug
1400 0 254 unless defined $identifier
1401 16 238 unless $identifier
1402 200 38 unless (defined $type and $name)
1403 92 108 if $identifier =~ /^(\d+)$/
1404 52 56 if $identifier =~ /^\"(.*)\"$/
1405 0 56 if $identifier =~ /^\'(.*)\'$/
1406 42 14 if ($identifier =~ /^([&\$\"]?)([A-Za-z_]\w*)$/) { }
14 0 elsif ($identifier =~ /^&(\w+)\((.*)\)$/) { }
1415 0 94 if $debug
1416 78 16 if (not $type) { }
0 16 elsif ($type eq '$') { }
16 0 elsif ($type eq '&') { }
1417 2 76 if (not defined $$ovr{$name}) { }
62 14 elsif (not ref $$ovr{$name}) { }
4 10 elsif (ref $$ovr{$name} eq 'ARRAY') { }
0 10 elsif (ref $$ovr{$name} eq 'SCALAR') { }
4 6 elsif (ref $$ovr{$name} eq 'HASH') { }
6 0 elsif (ref $$ovr{$name} eq 'CODE') { }
1419 2 0 $undef_asis ? :
1438 0 6 unless $$self{'eval_subroutine_refs'}
1448 0 16 if $debug
1449 0 16 unless $$self{'eval_subroutine_refs'}
1475 0 22 unless $name and $ovr
1476 6 16 if $name =~ /^bt_/
1477 0 16 unless $$ovr{$name}
1479 0 16 if $debug
1480 7 9 if ($args)
1481 0 7 if ($$self{'dynroutine_arg_cache'}{$args}) { }
1489 7 9 if (ref $args eq 'ARRAY') { }
1491 0 25 if ($$args[$_] eq '$_bt_dict') { }
0 25 elsif ($$args[$_] =~ /^\\(.*)$/) { }
0 25 elsif ($$args[$_] =~ /^\$([\$\&]?\w+)$/) { }
0 25 elsif ($$args[$_] =~ /^\$\{([^\}]+)\}$/) { }
1508 6 10 if (@real_args and not +($#real_args + 1) % 2)
1509 0 6 if $debug
1510 6 0 if (ref $$ovr{$name} eq 'CODE' or ref $$ovr{$name} eq 'ARRAY' and $#{$$ovr{$name};} == 2 and ref $$ovr{$name}[1] eq 'CODE')
1515 1 5 if ($ra{'bt_template'})
1524 14 2 if (ref $$ovr{$name} eq 'CODE') { }
2 0 elsif (ref $$ovr{$name} eq 'ARRAY' and $#{$$ovr{$name};} == 2) { }
1526 0 14 if $debug
1527 14 0 unless ref $buf
1528 0 0 if (ref $buf eq 'HASH' and $use_recursive_parse)
1529 0 0 if $debug
1534 0 2 if (not ref $$ovr{$name}[0]) { }
2 0 elsif (ref $$ovr{$name}[0] eq 'CODE') { }
1536 0 0 if $debug
1539 0 2 if ($use_recursive_parse and ref $seg eq 'HASH') { }
1543 0 0 if (ref $sseg eq 'SCALAR') { }
0 0 elsif (not ref $sseg) { }
1552 0 2 if (not ref $$ovr{$name}[1]) { }
2 0 elsif (ref $$ovr{$name}[1] eq 'CODE') { }
1556 3 2 if ($use_recursive_parse and ref $seg eq 'HASH') { }
1560 0 3 if (ref $sseg eq 'SCALAR') { }
3 0 elsif (not ref $sseg) { }
1570 0 2 if (not ref $$ovr{$name}[2]) { }
2 0 elsif (ref $$ovr{$name}[2] eq 'CODE') { }
1575 0 2 if ($use_recursive_parse and ref $seg eq 'HASH') { }
1618 2 9 if ($argstr =~ tr/"'//) { }
1623 14 0 unless $x eq q['']
1646 0 6 unless $name and $ovr
1647 0 6 if $debug
1648 6 0 if ($args)
1649 2 4 if ($$self{'dynroutine_arg_cache'}{$args}) { }
1657 6 0 if (ref $args eq 'ARRAY') { }
1662 1 5 unless ($$self{'pragma_enable'}{$name} and ref $$self{'pragma_functions'}{$name} eq 'CODE')
1664 0 1 if $debug
1684 0 212 unless defined $nr
1685 0 212 unless ref $nr
1687 0 212 if $debug
1688 42 170 if (not $$self{'reserved_words'}{$$nr} and $$nr =~ /^%?([&\$]?)(\w+)%?$/)
1690 0 42 if $debug
1691 42 0 if wantarray
1696 170 0 if wantarray
1717 0 145 unless ref $src
1720 145 0 if $$self{'compatibility_mode_0x'}
1722 0 145 unless $$src
1727 0 230 unless $$src =~ /([^%]*)(%([^%]*)%)?/gm
1730 2 228 if ($opseq eq '%%')
1736 18 212 unless $opseq
1743 42 170 if (($itype, $iname) = $self->is_identifier(\$opseq)) { }
84 86 elsif ($opcontent and not $opcontent =~ /^(if\s|elsif\s|fi$|else$)/ and $opcontent =~ tr/0-9A-Z^_a-z//) { }
1744 0 42 if $debug
1752 0 84 if $debug
1757 33 53 if $opseq =~ /^%if\s/
1759 29 57 if $opseq eq '%fi%'
1782 0 48 if (not $$self{'open_tainted_files'} and $self->is_tainted($fn))
1787 5 43 if $$self{'file_cache'}{$fn}
1790 0 43 unless (sysopen TMPL, $fn, 0)
1791 0 0 if $debug
1794 43 0 if $$self{'use_flock'}
1798 43 0 if $$self{'use_flock'}
1801 43 0 if $$self{'use_file_cache'}
1814 0 4 if ($type and not $file)
1820 0 4 unless $type and $type =~ /^(file|virtual|semisecure)$/ and $file
1822 0 4 if ($type eq 'semisecure') { }
2 2 elsif ($type eq 'virtual') { }
2 0 elsif ($type eq 'file') { }
1824 0 0 if ($file =~ /^(\w[\w\-.]{0,254})$/) { }
1829 0 0 if ($self->is_tainted($file) and not $$self{'bt_include_allow_tainted'})
1833 0 0 unless -e $file
1834 0 0 unless -f _
1835 0 0 unless -r _
1836 0 0 if $parse
1839 0 0 ref $buf eq 'SCALAR' ? :
1841 0 2 unless ($$self{'include_document_root'} or $ENV{'DOCUMENT_ROOT'})
1844 0 2 if ($self->is_tainted($file) and not $$self{'bt_include_allow_tainted'})
1850 0 2 unless -e $file
1851 0 2 unless -f _
1852 0 2 unless -r _
1853 2 0 if $parse
1855 0 0 ref $buf eq 'SCALAR' ? :
1857 0 2 if ($self->is_tainted($file) and not $$self{'bt_include_allow_tainted'})
1861 0 2 unless -e $file
1862 0 2 unless -f _
1863 0 2 unless -r _
1864 2 0 if $parse
1867 0 0 ref $buf eq 'SCALAR' ? :
1884 0 1 unless $type and $type =~ /^(cmd|cgi)$/ and $command
1887 1 0 if ($type eq 'cmd') { }
0 0 elsif ($type eq 'cgi') { }
1888 0 1 unless open IC, $command . '|'
1892 1 0 if ($parse and $buf)
1897 0 0 unless open IC, $command . '|'
1901 0 0 unless $_
1905 0 0 if ($parse and $buf)
1930 0 0 unless ref $L eq 'ARRAY'
1939 0 0 if defined $$l[3]
1940 0 0 if defined $$l[4]
1962 0 0 unless ref $sr eq 'ARRAY'
1964 0 0 if ($terse) { }
1965 0 0 if $x++
2038 0 52 unless defined $_[1]
2148 0 145 if ref $buf eq 'SCALAR'
2149 0 145 unless $buf
2159 33 112 if ($buf =~ /(%if\s+[^%]+%|%&\w+\([^\)]*\)%)/gm)
2165 102 10 unless $buf =~ /%\?|