Branch Coverage

blib/lib/HTML/Template/Compiled.pm
Criterion Covered Total %
branch 262 378 69.3


line true false branch
90 3 137 if (exists $args{'type'})
91 1 2 unless exists $args{'source'}
92 1 1 unless $args{'type'} =~ /^(?:filename|scalarref|arrayref|filehandle)$/
98 50 88 if (exists $args{'filename'}) { }
84 4 elsif (exists $args{'scalarref'}) { }
3 1 elsif (exists $args{'filehandle'}) { }
1 0 elsif (exists $args{'arrayref'}) { }
167 0 0 unless $args{'path'}
172 0 0 unless ($self->get_scalar)
185 1 53 unless defined $filename and length $filename
188 0 52 if (exists $args{'scalarref'} or exists $args{'arrayref'} or exists $args{'filehandle'})
194 0 52 unless $args{'path'}
197 11 41 if (my $t = $self->from_cache(\%args))
211 0 4 if (exists $args{'scalarref'} or exists $args{'arrayref'} or exists $args{'filename'})
220 0 4 unless $args{'path'}
223 0 4 if (my $t = $self->from_cache(\%args))
234 0 2 if (exists $args{'scalarref'} or exists $args{'filehandle'} or exists $args{'filename'})
247 0 87 if (exists $args{'arrayref'} or exists $args{'filehandle'} or exists $args{'filename'})
262 0 87 unless $args{'path'}
265 1 86 if (my $t = $self->from_cache(\%args))
284 18 22 if (not $htc or needs_new_check($cache || '', $filename, $self->get_expire_time))
295 83 62 if (not defined $path) { }
60 2 elsif (not ref $path) { }
302 0 145 if defined $ENV{'HTML_TEMPLATE_ROOT'}
310 72 91 if (defined $fname and not $self->get_scalar and not $self->get_filehandle) { }
87 4 elsif (defined $fname) { }
334 151 50 if ($self->get_cache)
336 110 41 unless defined $dir
340 37 114 if ($t)
342 0 37 if (@$plug)
346 2 35 if ($debug->{'cache'} & 8)
352 2 112 if ($debug->{'cache'} & 4)
359 33 131 if ($self->get_cache_dir)
360 5 28 $self->get_scalar || $self->get_filehandle ? :
364 0 33 if (defined $dir and not -d $dir)
368 2 31 if ($t)
370 0 2 if (@$plug)
374 1 1 if ($debug->{'cache'} & 2)
379 2 29 if ($debug->{'cache'} & 1)
396 8 25 unless my $times = $times->{$dir}{$fname}
398 22 3 if $now - $times->{'checked'} < $expire_time
407 37 114 if ($cached and $self->uptodate($times, $args))
427 17 21 unless defined $dir
434 35 3 unless $self->get_plugins
436 0 0 if (ref $plugs[$i])
437 0 0 if ($plugs[$i]->can('serialize'))
451 2 9 unless defined $dir
460 0 24 unless defined $dir
462 2 22 unless -d $dir
463 0 22 if ref $self
464 0 22 unless opendir my $dh, $dir
468 0 24 unless unlink $file
470 0 22 if ref $self
476 1 53 if $self->get_scalar
478 13 40 unless defined $expire_time
488 35 18 if ($now - $cached_times->{'checked'} < $expire_time) { }
496 4 14 if ($times[0] <= $cached_times->{'mtime'})
515 70 91 if (my $file = $self->get_file and not $self->get_scalar) { }
87 4 elsif (my $text = $self->get_scalar) { }
4 0 elsif (my $fh = $self->get_filehandle) { }
518 0 70 unless -f $file
523 37 31 if $self->get_cache
529 27 41 if ($self->get_cache_dir)
543 4 73 if ($self->get_cache_dir)
565 0 31 if (defined $cache and not -d $cache)
596 0 3 unless $self->get_plugins
597 3 0 if (ref $plug || $plug) eq $class
609 24 9 unless -f $req
627 0 10 if $@
630 7 3 if (($t->VERSION || '0.01') ne $cached_version or not $t->uptodate($cache->{'times'}))
638 1 2 if $t->get_cache
649 147 0 if ($path)
652 107 40 if defined $cached
654 0 40 if (not $path or 'File::Spec'->file_name_is_absolute($filename) and -f $filename) { }
661 39 1 if ($path and @$path) { }
1 0 elsif (-f $filename) { }
665 35 6 if (-f $fp)
672 1 3 if (defined $cwd)
674 1 0 if (-f $fp)
676 1 0 if ($fp =~ /^\Q$p\E(.*)/)
726 30 113 if ($args->{'file_cache'})
727 30 0 if $args->{'file_cache'}
729 40 103 exists $args->{'cache'} ? :
735 0 145 if (exists $args->{'cache_dir'})
738 0 0 unless (exists $args->{'file_cache'})
744 0 145 if ($args->{'plugin'} and ref $args->{'plugin'} ne 'ARRAY')
749 6 139 if ($debug_cache_args)
750 0 6 if (not ref $debug_cache_args) { }
756 6 18 if ($opt eq 'file_miss') { }
6 12 elsif ($opt eq 'file_hit') { }
6 6 elsif ($opt eq 'mem_miss') { }
6 0 elsif ($opt eq 'mem_hit') { }
773 0 725 if (exists $args->{$_})
777 0 145 if (exists $args->{'dumper'})
782 1 144 delete $args->{'debug'} ? :
784 1 144 if $debug_compiled
795 145 0 unless $args->{'optimize'}
827 49 82 if $args{'loop_context_vars'}
836 127 4 unless ($warnings eq 1 or $warnings eq 'fatal')
841 3 128 if ($args{'line_info'})
846 26 105 if ($args{'use_expressions'})
849 130 1 unless length $args{'open_mode'}
850 1 130 if ($args{'open_mode'})
856 3 128 if ($args{'filter'})
866 5 126 if (my $plugins = $args{'plugin'})
873 33 98 if (ref $tagstyle eq 'ARRAY')
882 0 131 if ref $args{'parser'} eq 'REF'
883 0 131 if (UNIVERSAL::isa($args{'parser'}, 'HTML::Template::Compiled::Parser'))
886 98 33 unless ($parser)
893 1 130 if ($args{'use_perl'})
900 1 130 if ($args{'no_includes'})
904 5 126 if (my $plugins = $self->get_plugins)
915 3 3 if ref $plug
916 0 3 if $_plugins{$plug}
917 1 2 if ($plug =~ /^::/)
920 0 3 if $_plugins{$plug}
921 0 3 unless ($plug->can('register'))
923 0 0 if ($@)
939 3 3 if (my $tagnames = $actions->{'tagnames'})
942 3 3 if (my $escape = $actions->{'escape'})
945 3 3 if (my $tags = $actions->{'compile'})
956 6 0 unless ref $plugins eq 'ARRAY'
975 0 70 unless open my $fh, "<$open_mode", $file
995 0 85 unless defined(my $f = $_[1])
1021 1 54 if (my $code = UNIVERSAL::can($item, $path)) { }
1026 33 21 unless exists $item->{$path}
1038 3 0 exists $fm->{$ref} ? :
1041 0 3 if ($global)
1046 3 0 if (defined $sub) { }
0 0 elsif (exists $item->{$key}) { }
1124 0 58 unless (defined $filename)
1137 0 58 unless $path
1141 27 31 if (my $cached = $new->from_cache($self->get_args))
1146 0 31 unless ($new->get_compiler)
1147 0 0 unless $self->get_args
1158 29 2 unless $self->get_plugins
1160 0 0 if (ref $plugs[$i])
1161 0 0 if ($plugs[$i]->can('serialize'))
1180 0 1 unless opendir my $dh, $dir
1186 1 0 if $success
1194 0 1 unless ref $files eq 'ARRAY'
1197 0 1 ref $file eq 'GLOB' ? :
0 1 ref $file eq 'ARRAY' ? :
1 1 ref $file eq 'SCALAR' ? :
1221 1 113 unless (@_)
1226 0 0 $self->[0] ? :
0 0 UNIVERSAL::can($self->[0], 'can') ? :
1230 3 110 if (@_ == 1) { }
1231 2 1 if (ref $_[0]) { }
1233 2 0 if (ref $_[0] eq 'HASH') { }
1251 5 107 unless ($self->get_case_sensitive)
1266 0 16 unless defined wantarray
1269 1 15 unless (my $info = $self->get_parse_tree)
1273 0 15 unless (ref $info)
1279 3 12 unless defined $tags
1280 8 7 unless ref $tags eq 'ARRAY'
1290 11 33 $item->{'type'} eq 'INCLUDE' && $include_info{$_} ? :
1293 14 2 if (defined($value = $pointer->{'children'}{lc $tag})) { }
2 0 elsif (defined($value = $includes{lc $tag})) { }
1303 3 12 if (not $what) { }
7 5 elsif ($what eq 'name') { }
5 0 elsif ($what eq 'loop') { }
1307 0 5 $item->{'type'} eq 'INCLUDE' && $include_info{$_} ? :
1317 3 2 if ($pointer->{'type'} eq 'LOOP') { }
1321 0 9 $item->{'type'} eq 'INCLUDE' && $include_info{$_} ? :
1346 20 47 if (ref $data eq 'HASH') { }
7 40 elsif (ref $data eq 'ARRAY') { }
1370 131 0 ref $p eq 'HASH' ? :
1373 126 5 unless $fh
1374 1 130 if ($DEBUG) { }
1379 1 0 if ($@)
1393 0 41 if ($args{'compatible'}) { }
0 41 elsif ($args{'speed'}) { }
1406 1 40 if (exists $args{'short'})
1434 0 0 $bool ? :
1439 0 0 $bool ? :
1444 0 0 $bool ? :
1465 10 21 unless (-f $file)
1467 0 10 unless open $lock_fh, '>', $file
1471 0 31 unless open $lock_fh, '+<', $file
1486 0 0 if $loaded
1487 0 0 if $error
1491 0 0 if ($@)
1496 0 0 if ($@)
1513 0 2 if ($LAST_EXCEPTION and $LAST_EXCEPTION =~ /at (?:\(eval \d*\)|\S+) line (\d+)\./) { }
1518 0 0 if ($line > $#lines)
1521 0 0 $line > 0 ? :
1522 0 0 $line < $#lines ? :
1527 0 0 if ($html) { }