Branch Coverage

blib/lib/Plate.pm
Criterion Covered Total %
branch 257 260 98.8


line true false branch
64 183 135 unless $_[1]
66 298 20 length $text ? :
70 3 1 defined $3 ? :
4 6 defined $1 ? :
10 65 $cmnt =~ /^#(?:\s*line\s+(\d+)\s*(?:\s("?)([^"]+)\g2)?\s*|.*)$/u ? :
80 3 4 $defn =~ /\W/u ? :
84 158 10 unless $Plate::_s->{'keep_undef'}
85 77 91 if (length $_[1]) { }
84 7 elsif (not $Plate::_s->{'keep_undef'}) { }
87 3 78 unless exists $Plate::_s->{'filters'}{$_}
101 121 67 if (@expr) { }
102 81 40 if (defined $stmt) { }
103 26 55 if $pre
108 42 79 $_[0] ? :
112 146 42 unless $_[0]
116 318 196 if (length $1)
118 1 4 defined $stmt ? :
29 5 @expr ? :
34 284 if $add_lines
119 107 211 if $fix_line_num
122 24 312 if (not $pre and @Plate::_l and $Plate::_l[0] <= $+[1])
126 8 16 if $rem
131 75 439 if (defined $2) { }
8 431 elsif (defined $3) { }
7 424 elsif (defined $5) { }
4 420 elsif (defined $6) { }
100 320 elsif (defined $7) { }
68 252 elsif (defined $10) { }
140 2 6 unless (defined $4)
157 1 1 defined $stmt ? :
1 2 @expr ? :
3 1 if $add_lines
158 1 3 if $fix_line_num
164 28 72 if $fix_line_num
167 11 87 if $pre
173 27 41 if $pre or $fix_line_num
174 57 11 if (defined $tmpl) { }
175 25 32 if ($tmpl eq '_')
177 3 13 defined $args ? :
9 16 defined $9 ? :
178 4 5 defined $args ? :
179 4 5 $pre ? :
183 2 23 if $pre and $nl
186 14 18 defined $args ? :
190 2 17 $pre ? :
19 24 defined $9 ? :
192 1 41 if $pre and $nl
197 3 249 if ($tag ne $_[3])
200 2 1 $tag ? :
206 160 8 @expr ? :
81 168 defined $stmt ? :
207 17 64 if $pre and @expr
211 128 1 if not $pre and $Plate::_s->{'chomp'}
212 6 243 if defined $12
216 5 178 if (not $pre and @Plate::_l and $Plate::_l[0] <= $+[0])
220 2 3 if $rem
228 4 16 unless open my $fh, '<' . $_[0]{'io_layers'}, $_[1]
235 1 7 unless (open(my $fh, '>:utf8', $_[0]), umask $umask)[0]
245 46 68 if (length $file) { }
255 1 110 unless $sub = _eval($pl)
257 1 109 unless defined($pl = eval { do { &$sub() } })
262 5 99 unless $sub = _eval($pl)
265 8 91 if defined $_[2]
266 8 90 if defined $_[4]
272 9 2 unless @mkdir
279 43 6 defined $_[0]{'path'} ? :
282 27 11 defined $_[0]{'cache_path'} ? :
288 26 11 if (defined $cache) { }
10 1 elsif (defined $plate) { }
289 8 18 if ($_[0]{'static'}) { }
290 1 0 $@ ? :
4 4 if -f $cache
294 7 8 if (-f $cache and ($_[0]{'mod'}{$_[1]} // (stat _)[9]) >= $_n)
295 1 0 $@ ? :
302 3 7 unless $_[0]{'static'} or exists $_[0]{'mod'}{$_[1]}
309 146 5 if $_[0]{'static'} or not exists $_[0]{'mod'}{$_[1]}
310 1 4 unless my $mod = (stat $_[0]->_plate_file($_[1]))[9]
312 3 1 if $_[0]{'mod'}{$_[1]} == $mod
318 151 29 $Plate::_s->{'cache_code'} ? :
324 6 138 if ($tmpl eq '_')
325 3 3 unless @Plate::_c
326 2 1 if (defined(my $c = pop())) { }
335 1 137 if (@Plate::_c >= $Plate::_s->{'max_call_depth'})
351 1 1 length $vol || !$_[1] ? :
2 19 unless length $path
353 8 1 if $_[1] and not length $vol and length $dir[0] || @dir == 1
629 16 3 if @_
658 5 1 ref $_c eq 'SCALAR' ? :
92 6 ref $_c eq 'CODE' ? :
660 62 36 ref $tmpl eq 'SCALAR' ? :
681 50 1 @Plate::_c ? :
684 3 1 if @Plate::_c
708 18 13 if $_[0]{'mod'}
709 1 30 ref $_[2] eq 'CODE' ? :
716 2 1 if (defined $_[1]) { }
744 1 3 if $_[0]{'cache_code'} and not $_[0]{'static'} and exists $_[0]{'mod'}{$_[1]}
747 6 1 unless exists $_[0]{'mem'}{$_[1]}
752 1 6 ref $_[1] eq 'SCALAR' ? :
775 4 68 if ($k eq 'encoding') { }
15 53 elsif ($k eq 'path') { }
11 42 elsif ($k eq 'cache_path') { }
5 37 elsif ($k =~ /^(?:(?:cache_)?suffix|init|io_layers|once)$/u) { }
9 28 elsif ($k eq 'filters') { }
5 23 elsif ($k eq 'vars') { }
3 20 elsif ($k eq 'package') { }
1 19 elsif (not $k =~ /^(?:auto_filter|cache_code|chomp|keep_undef|max_call_depth|static|umask)$/u) { }
777 1 2 $v eq 'utf8' ? :
3 1 length $v ? :
779 10 5 if length $v
782 10 1 if defined $v
786 8 1 if (defined $v) { }
787 1 7 unless ref $v eq 'HASH'
789 1 7 unless $name =~ /^\w+$/u
791 5 2 if (defined $code) { }
795 1 1 $code =~ /(.*)::(.*)/u ? :
1 4 unless ref $code eq 'CODE' or $code = $code =~ /(.*)::(.*)/u ? $1->can($2) : do { my($i, $p) = 0; ++$i while 'Plate' eq ($p = caller $i); $p->can($code) }
811 4 1 if (defined $v) { }
812 1 3 unless ref $v eq 'HASH'
814 6 1 if (defined $ref) { }
816 4 2 if $sigil ne '&'
827 2 1 unless defined $v and $v =~ /^[A-Z_a-z][0-9A-Z_a-z]*(?:::[0-9A-Z_a-z]+)*$/u
835 40 4 if (defined $self->{'path'}) { }
837 19 21 length $self->{'path'} ? :
838 1 39 unless -d $dir and -r _
839 7 32 if $self->{'static'} and $self->{'static'} eq 'auto'
844 15 28 if (defined $self->{'cache_path'}) { }
9 19 elsif (not $self->{'cache_code'}) { }
846 10 5 if (-d $dir) { }
847 0 10 unless -w _
850 1 4 unless (mkdir($dir), umask $umask)[0]