line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Cot::Plugin::TT; |
2
|
1
|
|
|
1
|
|
680
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
31
|
|
3
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
28
|
|
4
|
1
|
|
|
1
|
|
31
|
use 5.008005; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
38
|
|
5
|
|
|
|
|
|
|
our $VERSION = "0.01"; |
6
|
1
|
|
|
1
|
|
5573
|
use Template; |
|
1
|
|
|
|
|
47708
|
|
|
1
|
|
|
|
|
30
|
|
7
|
1
|
|
|
1
|
|
8
|
use File::Spec; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
17
|
|
8
|
1
|
|
|
1
|
|
5
|
use parent qw(Cot::Plugin); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
10
|
|
9
|
1
|
|
|
1
|
|
1285
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
227
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub init { |
12
|
1
|
|
|
1
|
0
|
68
|
my ( $self, $c ) = @_; |
13
|
1
|
|
|
|
|
10
|
$c->tt($self); |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub _root { |
17
|
0
|
|
0
|
0
|
|
|
File::Spec->catdir( $ENV{COT_ROOT} || '.', "tmpl" ); |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub output { |
21
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
22
|
0
|
|
|
|
|
|
my $ttfile = File::Spec->catfile( __PACKAGE__->_root, shift ); |
23
|
0
|
0
|
|
|
|
|
croak "template file not found.[$ttfile]" unless ( -f $ttfile ); |
24
|
0
|
|
|
|
|
|
my $param = shift; |
25
|
0
|
|
|
|
|
|
my $output = ''; |
26
|
0
|
|
|
|
|
|
my $tt = |
27
|
|
|
|
|
|
|
Template->new( { INCLUDE_PATH => __PACKAGE__->_root, ABSOLUTE => 1, } ); |
28
|
0
|
0
|
|
|
|
|
$tt->process( $ttfile, $param, \$output ) |
29
|
|
|
|
|
|
|
or croak $tt->error; |
30
|
0
|
|
|
|
|
|
return $output; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
1; |
34
|
|
|
|
|
|
|
__END__ |