File Coverage

blib/lib/Thunderhorse/Module/Template.pm
Criterion Covered Total %
statement 28 28 100.0
branch n/a
condition n/a
subroutine 7 7 100.0
pod 1 1 100.0
total 36 36 100.0


line stmt bran cond sub pod time code
1             package Thunderhorse::Module::Template;
2             $Thunderhorse::Module::Template::VERSION = '0.102';
3 1     1   907 use v5.40;
  1         6  
4 1     1   7 use Mooish::Base -standard;
  1         3  
  1         14  
5              
6 1     1   20350 use Gears::X::Thunderhorse;
  1         3  
  1         40  
7 1     1   753 use Gears::Template::TT;
  1         4169  
  1         410  
8              
9             extends 'Thunderhorse::Module';
10              
11             has field 'template' => (
12             isa => InstanceOf ['Gears::Template'],
13             lazy => 1,
14             );
15              
16             sub _build_template ($self)
17 1     1   16 {
  1         3  
  1         2  
18 1         9 my $config = $self->config;
19              
20 1         13 return Gears::Template::TT->new($config->%*);
21             }
22              
23             sub build ($self)
24 1     1 1 8753 {
  1         3  
  1         3  
25 1         2 weaken $self;
26 1         36 my $tpl = $self->template;
27              
28 6         9 $self->add_method(
29 6     6   8 controller => template => sub ($controller, $template, $vars = {}) {
  6         9  
  6         11  
  6         8  
30 6         29 return $tpl->process($template, $vars);
31             }
32 1         4555 );
33             }
34              
35             __END__