| 1 | package Pickles::View::TT; | ||||||||||||
| 2 | 2 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 3 | 2 | ▶ | use base qw(Pickles::View); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | 2 | ▶ | use Template; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | |||||||||||||
| 6 | 2 | __PACKAGE__->config( TEMPLATE_EXTENSION => '.html' ); | |||||||||||
| 7 | |||||||||||||
| 8 | 2 | ▶ | sub new { | ||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||
| 9 | 2 | my $class = shift; | |||||||||||
| 10 | 2 | my $self = bless {}, $class; | |||||||||||
| 11 | 2 | $self; | |||||||||||
| 12 | } | ||||||||||||
| 13 | |||||||||||||
| 14 | 2 | ▶ | sub render { | ||||||||||
|
Subroutine
render: called CC=5 SCAR=16.4
Pod
undocumented
| |||||||||||||
| 15 | 2 | my( $self, $c ) = @_; | |||||||||||
| 16 | |||||||||||||
| 17 | 2 | my $tt = $self->{tt}; | |||||||||||
| 18 | 2 | ▶ | if (! $tt) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 19 | 2 | my $config = $self->merge_config( $c ); | |||||||||||
| 20 | $tt = $self->{tt} = Template->new({ | ||||||||||||
| 21 | ENCODING => 'utf8', | ||||||||||||
| 22 | UNICODE => 1, | ||||||||||||
| 23 | ABSOLUTE => 1, | ||||||||||||
| 24 | INCLUDE_PATH => [ | ||||||||||||
| 25 | $c->config->path_to('view'), | ||||||||||||
| 26 | $c->config->path_to('view', 'inc'), | ||||||||||||
| 27 | ], | ||||||||||||
| 28 | 2 | %{$config}, | |||||||||||
| 29 | }); | ||||||||||||
| 30 | 2 | ▶ | $self->{suffix} = $config->{TEMPLATE_EXTENSION} || '.tt2'; | ||||||||||
|
Condition50%1/2
$config->{'TEMPLATE_EXTENSION'} || '.tt2'
MC/DC0%0/1
$config->{'TEMPLATE_EXTENSION'} || '.tt2'
$config->{'TEMPLATE_EXTENSION'}
Truth table50%1/2
A
A= $config->{'TEMPLATE_EXTENSION'}
| |||||||||||||
| 31 | } | ||||||||||||
| 32 | 2 | my $template = $c->stash->{'VIEW_TEMPLATE'}; | |||||||||||
| 33 | 2 | ▶ | unless ( $template =~ /$self->{suffix}$/ ) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 34 | 2 | $template .= $self->{suffix}; | |||||||||||
| 35 | } | ||||||||||||
| 36 | $tt->process( $template, { | ||||||||||||
| 37 | 2 | ▶ | %{$c->stash}, | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 38 | c => $c, | ||||||||||||
| 39 | }, \my $output ) or die $tt->error; | ||||||||||||
| 40 | 2 | return $output; | |||||||||||
| 41 | } | ||||||||||||
| 42 | |||||||||||||
| 43 | 2 | 1; | |||||||||||
| 44 | |||||||||||||
| 45 | __END__ | ||||||||||||