line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Pickles::View::TT; |
2
|
2
|
|
|
2
|
|
2409
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
67
|
|
3
|
2
|
|
|
2
|
|
11
|
use base qw(Pickles::View); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
1123
|
|
4
|
2
|
|
|
2
|
|
1980
|
use Template; |
|
2
|
|
|
|
|
51830
|
|
|
2
|
|
|
|
|
581
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
__PACKAGE__->config( TEMPLATE_EXTENSION => '.html' ); |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new { |
9
|
2
|
|
|
2
|
0
|
4
|
my $class = shift; |
10
|
2
|
|
|
|
|
7
|
my $self = bless {}, $class; |
11
|
2
|
|
|
|
|
11
|
$self; |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub render { |
15
|
2
|
|
|
2
|
0
|
7
|
my( $self, $c ) = @_; |
16
|
|
|
|
|
|
|
|
17
|
2
|
|
|
|
|
18
|
my $tt = $self->{tt}; |
18
|
2
|
50
|
|
|
|
8
|
if (! $tt) { |
19
|
2
|
|
|
|
|
18
|
my $config = $self->merge_config( $c ); |
20
|
2
|
|
|
|
|
272
|
$tt = $self->{tt} = Template->new({ |
21
|
|
|
|
|
|
|
ENCODING => 'utf8', |
22
|
|
|
|
|
|
|
UNICODE => 1, |
23
|
|
|
|
|
|
|
ABSOLUTE => 1, |
24
|
|
|
|
|
|
|
INCLUDE_PATH => [ |
25
|
|
|
|
|
|
|
$c->config->path_to('view'), |
26
|
|
|
|
|
|
|
$c->config->path_to('view', 'inc'), |
27
|
|
|
|
|
|
|
], |
28
|
2
|
|
|
|
|
11
|
%{$config}, |
29
|
|
|
|
|
|
|
}); |
30
|
2
|
|
50
|
|
|
54742
|
$self->{suffix} = $config->{TEMPLATE_EXTENSION} || '.tt2'; |
31
|
|
|
|
|
|
|
} |
32
|
2
|
|
|
|
|
19
|
my $template = $c->stash->{'VIEW_TEMPLATE'}; |
33
|
2
|
50
|
|
|
|
42
|
unless ( $template =~ /$self->{suffix}$/ ) { |
34
|
2
|
|
|
|
|
7
|
$template .= $self->{suffix}; |
35
|
|
|
|
|
|
|
} |
36
|
2
|
|
|
|
|
10
|
$tt->process( $template, { |
37
|
2
|
50
|
|
|
|
4
|
%{$c->stash}, |
38
|
|
|
|
|
|
|
c => $c, |
39
|
|
|
|
|
|
|
}, \my $output ) or die $tt->error; |
40
|
2
|
|
|
|
|
279
|
return $output; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
1; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
__END__ |