Simple/TT.pm

filter: Statementstmt 96.8% 31 / 32 Branchbran 37.5% 3 / 8 Conditioncond 50.0% 2 / 4 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 8 / 8 Podpod 100% 2 / 2 totaltotal 82.1% 46 / 56 CC 7 SCAR 16.4
CC
7
Cov
82%
process
9.4
BEGIN
1.0
BEGIN
1.0
CRAP 5.2
« Simple/HTML/Template.pm ↑ Summary Simple/Scalar.pm »
1 package Mail::Builder::Simple::TT;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use Template;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use Cwd;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use Exception::Died;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 1 ▶use 5.008_008;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 1 our $VERSION = '0.03';
12  
13 2 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod documented
14 2 my ( $class, $args, $vars ) = @_;
15  
16 2 my $self = {
17 template_args => $args,
18 template_vars => $vars,
19 };
20  
21 2 return bless $self, $class;
22 }
23  
24 1 ▶sub process {
Subroutine process: called CC=7 SCAR=22.4
Pod documented
25 1 my ( $self, $template, $source ) = @_;
26  
27 1 my $args = $self->{template_args};
28 1 ▶ $args->{INCLUDE_PATH} ||= q{.};
Condition50%1/2
$args->{"INCLUDE_PATH"} ||= "."
l!l
01
MC/DC0%0/1
$args->{"INCLUDE_PATH"} ||= "."
$args->{"INCLUDE_PATH"}
Truth table50%1/2
A
A= $args->{"INCLUDE_PATH"}
Aresult
11
00
29 1 ▶ $args->{ENCODING} ||= 'utf8';
Condition50%1/2
$args->{"ENCODING"} ||= "utf8"
l!l
01
MC/DC0%0/1
$args->{"ENCODING"} ||= "utf8"
$args->{"ENCODING"}
Truth table50%1/2
A
A= $args->{"ENCODING"}
Aresult
11
00
30  
31 1 my $t = Template->new($args);
32  
33 1 my $output = q{};
34 1 ▶ if ( $source eq 'file' ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($source eq 'file') { } 0 1 1
elsif ($source eq 'scalar') { } 1 0 1
35 0 ▶ $t->process( $template, $self->{template_vars}, \$output )
Branch: 1 branch
BranchTrueFalseTotal
$t->process($template, $self->{"template_vars"}, \$output) or "Exception::Died"->throw($t->error) 0 0 0
36 || Exception::Died->throw( $t->error );
37 }
38 elsif ( $source eq 'scalar' ) {
39 1 ▶ $t->process( \$template, $self->{template_vars}, \$output )
Branch: 1 branch
BranchTrueFalseTotal
$t->process(\$template, $self->{"template_vars"}, \$output) or "Exception::Died"->throw($t->error) 1 0 1
40 || Exception::Died->throw( $t->error );
41 }
42  
43 1 return $output;
44 }
45  
46 1 1;
47  
48 __END__
« Simple/HTML/Template.pm ↑ Summary Simple/Scalar.pm »