Pickles/View/MicroTemplate.pm untested

filter: Statementstmt 0.0% 0 / 24 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 38 CC 2 SCAR 12.0
CC
2
Cov
0%
render
6.0
new
2.0
BEGIN
2.0
CRAP 3.3
1 package Pickles::View::MicroTemplate;
2 use strict;
3 use base qw(Pickles::View);
4 use Text::MicroTemplate::Extended;
5  
6 __PACKAGE__->config( extension => '.mt' );
7  
8 sub new {
9 my $class = shift;
10 my $self = bless {}, $class;
11 $self;
12 }
13  
14 sub render {
15 my( $self, $c ) = @_;
16 my $config = $self->merge_config( $c );
17 my %args = (
18 %{$c->stash},
19 c => $c,
20 );
21 my $mt = Text::MicroTemplate::Extended->new(
22 include_path => [
23 $c->config->path_to('view'),
24 $c->config->path_to('view', 'inc'),
25 ],
26 %{$config},
27 template_args => \%args,
28 );
29 my $template = $c->stash->{'VIEW_TEMPLATE'};
30 # $body is-a Text::MicroTemplate::EncodedString
31 my $body = $mt->render( $template );
32 (ref $body && $body->can('as_string')) ? $body->as_string : $body;
33 }
34  
35 1;
36  
37 __END__