line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CGI::Application::Plugin::View::HTML::Template; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
82592
|
use strict; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
86
|
|
4
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
290
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
11
|
use vars qw($VERSION); |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
847
|
|
7
|
|
|
|
|
|
|
require Exporter; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
$VERSION = '0.02'; |
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
10
|
sub import { my $caller = scalar(caller); |
13
|
1
|
|
|
|
|
12
|
$caller->add_callback('postrun', \&my_postrun); |
14
|
1
|
|
|
|
|
1811
|
goto &Exporter::import } |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub my_postrun { |
18
|
|
|
|
|
|
|
|
19
|
1
|
|
|
1
|
0
|
66742
|
my ($self, $bodyref) = @_; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# Don't do anything for 'redirect' and 'none'. |
22
|
1
|
50
|
|
|
|
7
|
if ($self->header_type() ne 'header') { |
23
|
0
|
|
|
|
|
0
|
return; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# Try to automatically populate the template. |
28
|
1
|
|
|
|
|
17
|
my $template = $self->param('template'); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# Not an H::T template? |
31
|
1
|
50
|
33
|
|
|
22
|
if (ref($template) ne 'HTML::Template' and ref($template) ne 'HTML::Template::Compiled') { |
32
|
0
|
|
|
|
|
0
|
return; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
# If the template param name is in the stash, set the template using it. |
36
|
1
|
|
|
|
|
6
|
foreach my $name ($template->param()) { |
37
|
|
|
|
|
|
|
|
38
|
1
|
|
|
|
|
12
|
my $param = $self->param($name); |
39
|
|
|
|
|
|
|
|
40
|
1
|
50
|
|
|
|
14
|
if ($param) { |
41
|
1
|
|
|
|
|
4
|
$template->param($name => $param); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
# Add to what this plugin was called with. |
46
|
1
|
|
|
|
|
83
|
${$bodyref} .= $template->output(); |
|
1
|
|
|
|
|
4
|
|
47
|
|
|
|
|
|
|
|
48
|
1
|
|
|
|
|
46
|
return; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
1; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
__END__ |