| 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
| |||||||||||
| 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
| |||||||||||
| 31 | }; | ||||||||||
| 32 | 0 | ▶ | die "Template Toolkit error:\n$@" if $@; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 33 | 0 | return $output; | |||||||||
| 34 | } | ||||||||||
| 35 | |||||||||||
| 36 | 2 | __DATA__ | |||||||||