Branch Coverage

blib/lib/Dotiac/DTL.pm
Criterion Covered Total %
branch 24 54 44.4


line true false branch
37 0 0 if (-e $file) { }
0 0 elsif (-e "$file.html") { }
0 0 elsif (-e "$file.txt") { }
47 0 0 if -e 'File::Spec'->catfile($dir, "$file.html")
48 0 0 if -e 'File::Spec'->catfile($dir, "$file.txt")
49 0 0 if -e 'File::Spec'->catfile($dir, $file)
52 0 0 if -e $file
77 1 293 if (ref $data eq 'SCALAR') { }
293 0 elsif (not ref $data) { }
88 133 0 if (-e "$data.pm" and $compile && $compile > 0 || !defined($compile))
89 133 0 if (-e $data) { }
90 132 1 if ((stat "$data.pm")[9] > (stat "$data")[9]) { }
93 114 18 unless $cache{"$data.pm"}
103 0 132 unless (eval { do { $cache{"$data.pm"} = {'template', 'Dotiac::DTL::Compiled'->new('Dotiac::DTL::Compiled::' . (require "$data.pm")), 'currentdir', $Dotiac::DTL::currentdir, 'params', {%Dotiac::DTL::params}, 'parser', $Dotiac::DTL::PARSER, 'changetime', (stat "$data.pm")[9]} unless $cache{"$data.pm"}; $t = "$data.pm"; $compile = 0; 1 } })
111 1 0 if $compile or not defined $compile
115 0 0 if ($cache{"$data.pm"} and exists $cache{"$data.pm"}{'changetime'} and $cache{"$data.pm"}{'changetime'} < (stat "$data.pm")[9])
121 0 0 unless $cache{"$data.pm"}
131 0 0 unless (eval { do { $cache{"$data.pm"} = {'template', 'Dotiac::DTL'->compiled('Dotiac::DTL::Compiled::' . (require "$data.pm")), 'currentdir', $Dotiac::DTL::currentdir, 'params', {%Dotiac::DTL::params}, 'parser', $Dotiac::DTL::PARSER, 'changetime', (stat "$data.pm")[9]} unless $cache{"$data.pm"}; $t = "$data.pm"; $compile = 0; 1 } })
137 2 39 if ($cache{$t} and $t eq $data and exists $cache{$t}{'changetime'} and $cache{$t}{'changetime'} < (stat "$t")[9])
140 122 171 unless ($cache{$t})
141 0 122 unless open my $fh, '<', $data
153 123 171 unless ($cache{$t})
154 0 123 unless eval "require $Dotiac::DTL::PARSER;"
172 0 123 unless (eval { do { $cache{$t} = {'template', $parser->parse($data, \$pos), 'currentdir', $Dotiac::DTL::currentdir, 'params', {%Dotiac::DTL::params}, 'parser', $Dotiac::DTL::PARSER, 'changetime', $changetime}; 1 } })
177 128 166 if ($compile and $compile > 0)
178 128 0 if (open my $cp, '>', "$t.pm") { }
204 0 128 unless (eval { do { require Data::Dumper; $Data::Dumper::Indent = 2; $Data::Dumper::Useqq = 1; my $template = $cache{$t}{'template'}; my $digest = Digest::MD5::md5_hex($t); print $cp "#Autogenerated\n"; print $cp "package Dotiac::DTL::Compiled::$digest;\nuse strict;\nuse warnings;\nrequire Scalar::Util;\n#PARAMS USED:\nour "; print $cp 'Data::Dumper'->Dump([$cache{$t}{'params'}], ['$params']); $template->perl($cp, 0, $digest); print $cp "\n#INIT\n"; $template->perlinit($cp, 0, $digest); print $cp qq[\nsub string {\n\tmy \$vars=shift;\n\tmy \$escape=shift;\n\tmy \$r="";\n]; $template->perlstring($cp, 0, 1, $digest); print $cp "\treturn \$r;\n}\n"; print $cp "sub print {\n\tmy \$vars=shift;\n\tmy \$escape=shift;\n"; $template->perlprint($cp, 0, 1, $digest); print $cp "}\n"; print $cp "sub eval {\n\tmy \$vars=shift;\n\tmy \$escape=shift;\n"; $template->perleval($cp, 0, 1, $digest); print $cp "}\n"; print $cp qq["$digest";]; close $cp; 1 } })