Simple/HTML/Template.pm

filter: Statementstmt 93.3% 28 / 30 Branchbran 50.0% 3 / 6 Conditioncond 42.8% 3 / 7 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 100% 6 / 6 Podpod 100% 2 / 2 totaltotal 76.3% 42 / 55 CC 7 SCAR 17.2
CC
7
Cov
79%
process
8.8
BEGIN
1.0
BEGIN
1.0
CRAP 5.6
« Simple.pm ↑ Summary Simple/TT.pm »
1 package Mail::Builder::Simple::HTML::Template;
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 HTML::Template;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 ▶use 5.008_008;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 1 our $VERSION = '0.03';
10  
11 2 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod documented
12 2 my ( $class, $args, $vars ) = @_;
13  
14 2 my $self = {
15 template_args => $args,
16 template_vars => $vars,
17 };
18  
19 2 return bless $self, $class;
20 }
21  
22 1 ▶sub process {
Subroutine process: called CC=7 SCAR=21.8
Pod documented
23 1 my ( $self, $template, $source ) = @_;
24  
25 1 my $args = $self->{template_args};
26 1 ▶ $args->{path} ||= q{.};
Condition50%1/2
$args->{"path"} ||= "."
l!l
01
MC/DC0%0/1
$args->{"path"} ||= "."
$args->{"path"}
Truth table50%1/2
A
A= $args->{"path"}
Aresult
11
00
27 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
28 $args->{die_on_bad_params} = ($args->{die_on_bad_params}
29 1 ▶ and $args->{die_on_bad_params} eq 'yes') ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$args->{'die_on_bad_params'} && $args->{'die_on_bad_params'} eq 'yes' ? : 0 1 1
Condition33%1/3
$args->{"die_on_bad_params"} and $args->{"die_on_bad_params"} eq "yes"
!ll&&!rl&&r
100
MC/DC0%0/2
$args->{"die_on_bad_params"} and $args->{"die_on_bad_params"} eq "yes"
$args->{"die_on_bad_params"} $args->{"die_on_bad_params"} eq "yes"
Truth table33%1/3
A and B
A= $args->{"die_on_bad_params"}B= $args->{"die_on_bad_params"} eq "yes"
ABresult
0X0
100
111
30  
31 1 my $t;
32 1 ▶ if ( $source eq 'file' ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($source eq 'file') { } 0 1 1
elsif ($source eq 'scalar') { } 1 0 1
33 0 $t = HTML::Template->new( filename => $template, %{$args} );
34 }
35 elsif ( $source eq 'scalar' ) {
36 1 $t = HTML::Template->new( scalarref => \$template, %{$args} );
37 }
38  
39 1 $t->param( %{ $self->{template_vars} } );
40  
41 1 return $t->output;
42 }
43  
44 1 1;
45  
46 __END__
« Simple.pm ↑ Summary Simple/TT.pm »