line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Template::Plugin::HTML::Template; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
90794
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
71
|
|
4
|
2
|
|
|
2
|
|
9
|
use vars qw($VERSION $DYNAMIC $FILTER_NAME); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
149
|
|
5
|
|
|
|
|
|
|
$VERSION = 0.02; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
$DYNAMIC = 1; |
8
|
|
|
|
|
|
|
$FILTER_NAME = 'html_template'; |
9
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
|
3401
|
use HTML::Template; |
|
2
|
|
|
|
|
38131
|
|
|
2
|
|
|
|
|
100
|
|
11
|
2
|
|
|
2
|
|
24
|
use base qw(Template::Plugin::Filter); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
2044
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub init { |
14
|
2
|
|
|
2
|
0
|
3964
|
my($self, $options) = @_; |
15
|
2
|
|
33
|
|
|
21
|
my $name = $self->{_ARGS}->[0] || $FILTER_NAME; |
16
|
2
|
|
|
|
|
12
|
$self->install_filter($name); |
17
|
2
|
|
|
|
|
85
|
$self->{_options} = $options; |
18
|
2
|
|
|
|
|
4
|
return $self; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub filter { |
22
|
2
|
|
|
2
|
0
|
178
|
my($self, $text, $args, $options) = @_; |
23
|
2
|
|
|
|
|
17
|
my $template = HTML::Template->new( |
24
|
|
|
|
|
|
|
strict => 0, |
25
|
|
|
|
|
|
|
die_on_bad_params => 0, |
26
|
2
|
|
|
|
|
5
|
%{$self->{_options}}, |
27
|
|
|
|
|
|
|
%$options, |
28
|
|
|
|
|
|
|
scalarref => \$text, |
29
|
|
|
|
|
|
|
); |
30
|
|
|
|
|
|
|
|
31
|
2
|
|
|
|
|
1249
|
my $stash = $self->{_CONTEXT}->stash; |
32
|
2
|
|
|
|
|
26
|
my @params = map { ($_ => $stash->{ $_ }) } grep !/^[\._]/, keys %$stash; |
|
14
|
|
|
|
|
25
|
|
33
|
2
|
|
|
|
|
11
|
$template->param(@params); |
34
|
2
|
|
|
|
|
211
|
return $template->output; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |
38
|
|
|
|
|
|
|
__END__ |