| 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"} ||= "."
MC/DC0%0/1
$args->{"path"} ||= "."
$args->{"path"}
Truth table50%1/2
A
A= $args->{"path"}
| |||||||||||||||||||||||||||||
| 27 | 1 | ▶ | $args->{ENCODING} ||= 'utf8'; | ||||||||||||||||||||||||||
|
Condition50%1/2
$args->{"ENCODING"} ||= "utf8"
MC/DC0%0/1
$args->{"ENCODING"} ||= "utf8"
$args->{"ENCODING"}
Truth table50%1/2
A
A= $args->{"ENCODING"}
| |||||||||||||||||||||||||||||
| 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
Condition33%1/3
$args->{"die_on_bad_params"} and $args->{"die_on_bad_params"} eq "yes"
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"
| |||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | 1 | my $t; | |||||||||||||||||||||||||||
| 32 | 1 | ▶ | if ( $source eq 'file' ) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 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__ | ||||||||||||||||||||||||||||