blib/lib/Gears/Template/TT.pm

filter: Statementstmt 96.3% 26 / 27 Branchbran 100% 8 / 8 Conditioncond 50.0% 4 / 8 MC/DCmcdc 20.0% 1 / 5 Subroutinesub 85.7% 6 / 7 Podpod 100% 1 / 1 totaltotal 82.1% 46 / 56 CC 8 SCAR 13.3
CC
8
Cov
88%
process
6.0
_build_engine
3.6
__ANON__
2.0
CRAP 3.8
« blib/lib/Thunderhorse/Router/SpecializedCache.pm ↑ Summary blib/lib/Thunderhorse/Response.pm »
1 package Gears::Template::TT;
2 4 $Gears::Template::TT::VERSION = '0.107';
3 4 ▶use v5.40;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use Mooish::Base -standard;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 4 ▶use Template;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 4 ▶use Gears::X::Template;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 4 extends 'Gears::Template';
10  
11 has param 'conf' => (
12 isa => HashRef,
13 0 ▶ default => sub { {} },
Subroutine __ANON__: not called CC=1 SCAR=6.9
14 4 );
15  
16 4 has field 'engine' => (
17 isa => InstanceOf ['Template'],
18 lazy => 1,
19 );
20  
21 2 ▶sub _build_engine ($self)
Subroutine _build_engine: called CC=3 SCAR=12.7
22 {
23 2 my %conf = $self->conf->%*;
24 2 ▶ $conf{ENCODING} //= $self->encoding;
Condition33%1/3
$conf{"ENCODING"} //= $self->encoding
l!l&&r!l&&!r
020
MC/DC0%0/2
$conf{"ENCODING"} //= $self->encoding
$conf{"ENCODING"} $self->encoding
Truth table33%1/3
A //= B
A= $conf{"ENCODING"}B= $self->encoding
ABresult
1X1
011
000
25 2 ▶ $conf{INCLUDE_PATH} //= $self->paths;
Condition33%1/3
$conf{"INCLUDE_PATH"} //= $self->paths
l!l&&r!l&&!r
020
MC/DC0%0/2
$conf{"INCLUDE_PATH"} //= $self->paths
$conf{"INCLUDE_PATH"} $self->paths
Truth table33%1/3
A //= B
A= $conf{"INCLUDE_PATH"}B= $self->paths
ABresult
1X1
011
000
26  
27 2 return Template->new(\%conf);
28 }
29  
30 # override process to let TT load the templates itself
31 7 ▶sub process ($self, $template, $vars)
Subroutine process: called CC=6 SCAR=17.9
Pod documented
32 {
33 7 ▶ my $pos = ref $template eq 'GLOB' ? tell $template : undef;
Branch: 1 branch
BranchTrueFalseTotal
ref $template eq 'GLOB' ? : 2 5 7
34  
35 7 ▶ $template =~ s{(\..+)?$}{$1 // '.tt' }e
Branch: 1 branch
BranchTrueFalseTotal
unless ref $template 4 3 7
Condition100%2/2
$1 // ".tt"
l!l
13
MC/DC100%1/1
$1 // ".tt"
$1
Truth table100%2/2
A
A= $1
Aresult
11
00
36 unless ref $template;
37  
38 7 my $output;
39 7 ▶ $self->engine->process($template, $vars, \$output)
Branch: 1 branch
BranchTrueFalseTotal
$self->engine->process($template, $vars, \$output) or "Gears::X::Template"->raise('' . $self->engine->error) 6 1 7
40 or Gears::X::Template->raise('' . $self->engine->error);
41  
42 # rewind if we were passed a handle
43 6 ▶ seek $template, $pos, 0
Branch: 1 branch
BranchTrueFalseTotal
if defined $pos 2 4 6
44 if defined $pos;
45  
46 6 return $output;
47 }
48  
« blib/lib/Thunderhorse/Router/SpecializedCache.pm ↑ Summary blib/lib/Thunderhorse/Response.pm »