line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Template::Plugin::Jcode; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
81286
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
82
|
|
4
|
2
|
|
|
2
|
|
10
|
use base qw(Template::Plugin); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
1697
|
|
5
|
2
|
|
|
2
|
|
5222
|
use Template::Plugin; |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
47
|
|
6
|
2
|
|
|
2
|
|
882
|
use Template::Stash; |
|
2
|
|
|
|
|
15976
|
|
|
2
|
|
|
|
|
51
|
|
7
|
2
|
|
|
2
|
|
1900
|
use Jcode; |
|
2
|
|
|
|
|
89630
|
|
|
2
|
|
|
|
|
241
|
|
8
|
2
|
|
|
2
|
|
19
|
use vars qw($VERSION $AUTOLOAD); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
731
|
|
9
|
|
|
|
|
|
|
$VERSION = '0.02'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
$Template::Stash::SCALAR_OPS->{ jcode } = sub { |
12
|
|
|
|
|
|
|
my $str = shift; |
13
|
|
|
|
|
|
|
return Template::Plugin::Jcode->new($str); |
14
|
|
|
|
|
|
|
}; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub new { |
17
|
6
|
|
|
6
|
1
|
12858
|
my($class, $str) = @_; |
18
|
6
|
|
|
|
|
80
|
bless { string => $str }, $class; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub AUTOLOAD { |
22
|
3
|
|
|
3
|
|
7
|
my $self = shift; |
23
|
3
|
|
|
|
|
10
|
my $method = $AUTOLOAD; |
24
|
|
|
|
|
|
|
|
25
|
3
|
|
|
|
|
19
|
$method =~ s/.*:://; |
26
|
3
|
50
|
|
|
|
13
|
return if $method eq 'DESTROY'; |
27
|
|
|
|
|
|
|
|
28
|
3
|
|
|
|
|
94
|
my $jcode = Jcode->new($self->{string}); |
29
|
3
|
50
|
|
|
|
601
|
return $self->_throw("no such Jcode method: $method") |
30
|
|
|
|
|
|
|
unless UNIVERSAL::can($jcode, $method); |
31
|
3
|
|
|
|
|
65
|
return $jcode->$method(@_); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub _throw { |
35
|
0
|
|
|
0
|
|
|
my $self = shift; |
36
|
0
|
|
|
|
|
|
die Template::Exception->new('jcode', join(', ', @_)); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
1; |
40
|
|
|
|
|
|
|
__END__ |