Pickles/View/TT.pm

filter: Statementstmt 100% 27 / 27 Branchbran 50.0% 3 / 6 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 2 totaltotal 83.7% 36 / 43 CC 5 SCAR 12.0
CC
5
Cov
89%
render
5.2
BEGIN
1.0
BEGIN
1.0
CRAP 3.3
« Pickles/View/MicroTemplate.pm ↑ Summary Pickles/Dispatcher.pm »
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
BranchTrueFalseTotal
unless ($tt) 2 0 2
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'
l!l
20
MC/DC0%0/1
$config->{'TEMPLATE_EXTENSION'} || '.tt2'
$config->{'TEMPLATE_EXTENSION'}
Truth table50%1/2
A
A= $config->{'TEMPLATE_EXTENSION'}
Aresult
11
00
31 }
32 2 my $template = $c->stash->{'VIEW_TEMPLATE'};
33 2 ▶ unless ( $template =~ /$self->{suffix}$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($template =~ /$self->{"suffix"}$/) 2 0 2
34 2 $template .= $self->{suffix};
35 }
36 $tt->process( $template, {
37 2 ▶ %{$c->stash},
Branch: 1 branch
BranchTrueFalseTotal
$tt->process($template, {%{$c->stash;}, "c", $c}, \my $output) or die $tt->error 2 0 2
38 c => $c,
39 }, \my $output ) or die $tt->error;
40 2 return $output;
41 }
42  
43 2 1;
44  
45 __END__
« Pickles/View/MicroTemplate.pm ↑ Summary Pickles/Dispatcher.pm »