Spoon/Template/TT2.pm

filter: Statementstmt 42.3% 11 / 26 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 3 / 6 Podpod 0.0% 0 / 3 totaltotal 34.1% 14 / 41 CC 4 SCAR 17.7
CC
4
Cov
34%
render
12.0
compile_dir
6.0
create_template_object
2.0
CRAP 5.9
« Spoon/DataObject.pm ↑ Summary Spoon/Utils.pm »
1 package Spoon::Template::TT2;
2 2 ▶use Spoon::Template -Base;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶ 
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 field template_object =>
5 -init => '$self->create_template_object';
6  
7 0 ▶sub compile_dir {
Subroutine compile_dir: not called CC=2 SCAR=17.9
Pod undocumented
8 0 my $dir = $self->plugin_directory . '/ttc';
9 0 ▶ mkdir $dir unless -d $dir;
Branch: 1 branch
BranchTrueFalseTotal
unless -d $dir 0 0 0
10 0 return $dir;
11 }
12
13 0 ▶sub create_template_object {
Subroutine create_template_object: not called CC=1 SCAR=6.9
Pod undocumented
14 0 require Template;
15 # XXX Make template caching a configurable option
16 0 Template->new({
17 INCLUDE_PATH => $self->path,
18 TOLERANT => 0,
19 COMPILE_DIR => $self->compile_dir,
20 COMPILE_EXT => '.ttc',
21 });
22 }
23  
24 0 ▶sub render {
Subroutine render: not called CC=3 SCAR=24.8
Pod undocumented
25 0 my $template = shift;
26  
27 0 my $output;
28 0 my $t = $self->template_object;
29 0 eval {
30 0 ▶ $t->process($template, {@_}, \$output) or die $t->error;
Branch: 1 branch
BranchTrueFalseTotal
$t->process($template, {@_}, \$output) or die $t->error 0 0 0
31 };
32 0 ▶ die "Template Toolkit error:\n$@" if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 0 0
33 0 return $output;
34 }
35  
36 2 __DATA__
« Spoon/DataObject.pm ↑ Summary Spoon/Utils.pm »