Branch Coverage

blib/lib/Plate.pm
Criterion Covered Total %
branch 239 242 98.7


line true false branch
64 191 137 unless $_[1]
66 306 22 length $text ? :
70 3 1 defined $3 ? :
4 6 defined $1 ? :
10 67 $cmnt =~ /^#(?:\s*line\s+(\d+)\s*(?:\s("?)([^"]+)\g2)?\s*|.*)$/u ? :
80 3 6 $defn =~ /\W/u ? :
84 165 10 unless $Plate::_s->{'keep_undef'}
85 80 95 if (length $_[1]) { }
88 7 elsif (not $Plate::_s->{'keep_undef'}) { }
98 125 70 if (@expr) { }
99 85 40 if (defined $stmt) { }
100 26 59 if $pre
105 45 80 $_[0] ? :
109 150 45 unless $_[0]
113 328 206 if (length $1)
115 1 4 defined $stmt ? :
31 5 @expr ? :
36 292 if $add_lines
116 114 214 if $fix_line_num
119 24 330 if (not $pre and @Plate::_l and $Plate::_l[0] <= $+[1])
123 8 16 if $rem
128 77 457 if (defined $2) { }
8 449 elsif (defined $3) { }
9 440 elsif (defined $5) { }
4 436 elsif (defined $7) { }
106 330 elsif (defined $8) { }
69 261 elsif (defined $11) { }
137 2 6 unless (defined $4)
150 7 2 $5 eq 'def' ? :
157 1 1 defined $stmt ? :
1 2 @expr ? :
3 1 if $add_lines
158 1 3 if $fix_line_num
164 30 76 if $fix_line_num
167 11 95 if $pre
173 28 41 if $pre or $fix_line_num
174 58 11 if (defined $tmpl) { }
175 26 32 if ($tmpl eq "_")
177 3 14 defined $args ? :
9 17 defined $10 ? :
178 4 5 defined $args ? :
179 4 5 $pre ? :
183 2 24 if $pre and $nl
186 15 17 defined $args ? :
190 2 17 $pre ? :
19 24 defined $10 ? :
192 1 42 if $pre and $nl
197 3 258 if ($tag ne $_[3])
200 2 1 $tag ? :
206 166 8 @expr ? :
84 174 defined $stmt ? :
207 17 67 if $pre and @expr
211 135 1 if not $pre and $Plate::_s->{'chomp'}
212 8 250 if defined $13
216 5 191 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 70 if (length $file) { }
255 1 112 unless $sub = _eval($pl)
257 1 111 unless defined($pl = eval { do { &$sub() } })
262 5 104 unless $sub = _eval($pl)
265 8 96 if defined $_[2]
266 8 95 if defined $_[4]
272 9 2 unless @mkdir
279 45 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 164 6 if $_[0]{'static'} or not exists $_[0]{'mod'}{$_[1]}
310 2 4 unless my $mod = (stat $_[0]->_plate_file($_[1]))[9]
312 3 1 if $_[0]{'mod'}{$_[1]} == $mod
318 170 29 $Plate::_s->{'cache_code'} ? :
324 6 155 if ($tmpl eq "_")
325 3 3 unless @Plate::_c
326 2 1 if (defined(my $c = pop())) { }
335 2 153 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
646 17 3 if @_
675 5 1 ref $_c eq 'SCALAR' ? :
96 6 ref $_c eq 'CODE' ? :
677 64 38 ref $tmpl eq 'SCALAR' ? :
698 51 1 @Plate::_c ? :
701 3 1 if @Plate::_c
725 19 12 if $_[0]{'mod'}
726 1 30 ref $_[2] eq 'CODE' ? :
733 2 1 if (defined $_[1]) { }
761 2 3 if $_[0]{'cache_code'} and not $_[0]{'static'} and exists $_[0]{'mod'}{$_[1]}
764 6 1 unless exists $_[0]{'mem'}{$_[1]}
769 1 7 ref $_[1] eq 'SCALAR' ? :
792 10 1 defined $_[1] ? :
795 1 2 $_[1] eq 'utf8' ? :
3 1 length $_[1] ? :
799 1 7 unless ref $_[1] eq "HASH"
803 1 7 unless $name =~ /^\w+$/u
805 5 2 if (defined $code) { }
809 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) }
822 10 5 length $_[1] ? :
825 2 1 unless defined $_[1] and $_[1] =~ /^[A-Z_a-z][0-9A-Z_a-z]*(?:::[0-9A-Z_a-z]+)*$/u
831 1 3 unless ref $_[1] eq "HASH"
835 7 1 if (defined $ref) { }
837 5 2 if $sigil ne "&"
849 1 75 unless my $c = $self->can("_set_$k")
854 43 4 if (defined $self->{'path'}) { }
856 20 23 length $self->{'path'} ? :
857 1 42 unless -d $dir and -r _
858 7 35 if $self->{'static'} and $self->{'static'} eq "auto"
863 16 30 if (defined $self->{'cache_path'}) { }
9 21 elsif (not $self->{'cache_code'}) { }
865 11 5 if (-d $dir) { }
866 0 11 unless -w _
869 1 4 unless (mkdir($dir), umask $umask)[0]