Miril/Template/Text/Template.pm untested

filter: Statementstmt 0.0% 0 / 31 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 9 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 41 CC 1 SCAR 6.9
CC
1
Cov
0%
load
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 package Miril::Template::Text::Template;
2
3 use strict;
4 use warnings;
5 use autodie;
6
7 use base 'Miril::Template::Abstract';
8
9 use Text::Template;
10 use File::Spec::Functions qw(catfile);
11 use Try::Tiny qw(try catch);
12 use Miril::Exception;
13
14 sub load {
15 my $self = shift;
16 my %options = @_;
17
18 my $tmpl;
19
20 try
21 {
22 $tmpl = Text::Template->new( TYPE => 'FILE', SOURCE => catfile($self->tmpl_path, $options{name}) );
23 }
24 catch
25 {
26 Miril::Exception->throw(
27 message => "Could not open template file",
28 errorvar => $_,
29 );
30 };
31
32 return $tmpl->fill_in( HASH => $options{params} );
33 }
34
35 1;