line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Template::Plugin::SafeInclude; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
114364
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
74
|
|
4
|
2
|
|
|
2
|
|
10
|
use strict; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
79
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
2326
|
use parent qw/Template::Plugin/; |
|
2
|
|
|
|
|
567
|
|
|
2
|
|
|
|
|
11
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub new { |
11
|
4
|
|
|
4
|
1
|
9791
|
my $class = shift; |
12
|
4
|
|
|
|
|
8
|
my $context = shift; |
13
|
4
|
|
|
|
|
6
|
my $args = shift; |
14
|
|
|
|
|
|
|
|
15
|
4
|
|
|
|
|
12
|
my $self = bless {}, $class; |
16
|
4
|
|
|
|
|
14
|
$self->{_context} = $context; |
17
|
4
|
|
|
|
|
9
|
$self->{_verbose} = $args->{verbose}; |
18
|
|
|
|
|
|
|
|
19
|
4
|
|
|
|
|
10
|
return $self; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub inc { |
23
|
4
|
|
|
4
|
1
|
116
|
my $self = shift; |
24
|
4
|
|
|
|
|
6
|
my $path = shift; |
25
|
4
|
|
|
|
|
7
|
my $param = shift; |
26
|
|
|
|
|
|
|
|
27
|
4
|
|
|
|
|
6
|
my $html = ""; |
28
|
4
|
|
|
|
|
6
|
eval { |
29
|
4
|
|
|
|
|
18
|
$html = $self->{_context}->include($path, $param); |
30
|
|
|
|
|
|
|
}; |
31
|
4
|
100
|
|
|
|
13908
|
unless ($@) { |
32
|
2
|
|
|
|
|
13
|
return $html; |
33
|
|
|
|
|
|
|
} |
34
|
2
|
100
|
|
|
|
27
|
if ($self->{_verbose}) { |
35
|
1
|
|
|
|
|
5
|
my $ret = sprintf "", $@; |
36
|
1
|
|
|
|
|
7
|
return $ret; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
1; # Magic true value required at end of module |
41
|
|
|
|
|
|
|
__END__ |