| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Text::MicroTemplate::DataSection; |
|
2
|
2
|
|
|
2
|
|
46708
|
use strict; |
|
|
2
|
|
|
|
|
6
|
|
|
|
2
|
|
|
|
|
73
|
|
|
3
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
66
|
|
|
4
|
2
|
|
|
2
|
|
12
|
use base 'Text::MicroTemplate::File', 'Exporter'; |
|
|
2
|
|
|
|
|
9
|
|
|
|
2
|
|
|
|
|
2406
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
|
7
|
|
|
|
|
|
|
our @EXPORT_OK = qw(render_mt); |
|
8
|
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
16666
|
use Carp; |
|
|
2
|
|
|
|
|
6
|
|
|
|
2
|
|
|
|
|
127
|
|
|
10
|
2
|
|
|
2
|
|
1942
|
use Encode; |
|
|
2
|
|
|
|
|
26451
|
|
|
|
2
|
|
|
|
|
185
|
|
|
11
|
2
|
|
|
2
|
|
2128
|
use Data::Section::Simple; |
|
|
2
|
|
|
|
|
1491
|
|
|
|
2
|
|
|
|
|
764
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub new { |
|
14
|
2
|
|
|
2
|
1
|
17
|
my $self = shift->SUPER::new(@_); |
|
15
|
2
|
|
50
|
|
|
99
|
$self->{package} ||= scalar caller; |
|
16
|
2
|
|
|
|
|
14
|
$self->{section} = Data::Section::Simple->new( $self->{package} ); |
|
17
|
|
|
|
|
|
|
|
|
18
|
2
|
|
|
|
|
17
|
$self; |
|
19
|
|
|
|
|
|
|
} |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub build_file { |
|
22
|
2
|
|
|
2
|
1
|
12
|
my ($self, $file) = @_; |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
# return cached entry |
|
25
|
2
|
50
|
|
|
|
9
|
if (my $e = $self->{cache}{ $file }) { |
|
26
|
0
|
|
|
|
|
0
|
return $e; |
|
27
|
|
|
|
|
|
|
} |
|
28
|
|
|
|
|
|
|
|
|
29
|
2
|
|
|
|
|
7
|
my $data = $self->{section}->get_data_section($file); |
|
30
|
2
|
50
|
|
|
|
153
|
if ($data) { |
|
31
|
2
|
|
|
|
|
8
|
$self->parse(decode_utf8 $data); |
|
32
|
|
|
|
|
|
|
|
|
33
|
2
|
|
|
|
|
337
|
local $Text::MicroTemplate::_mt_setter = 'my $_mt = shift;'; |
|
34
|
2
|
|
|
|
|
10
|
my $f = $self->build(); |
|
35
|
|
|
|
|
|
|
|
|
36
|
2
|
50
|
|
|
|
670
|
$self->{cache}{$file} = $f if $self->{use_cache}; |
|
37
|
2
|
|
|
|
|
43
|
return $f; |
|
38
|
|
|
|
|
|
|
} |
|
39
|
0
|
|
|
|
|
0
|
croak "could not find template file: $file in __DATA__ section"; |
|
40
|
|
|
|
|
|
|
} |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub render_mt { |
|
43
|
2
|
50
|
|
2
|
1
|
971
|
my $self = ref $_[0] ? shift : __PACKAGE__->new(package => scalar caller); |
|
44
|
2
|
|
|
|
|
14
|
$self->render_file(@_); |
|
45
|
|
|
|
|
|
|
} |
|
46
|
|
|
|
|
|
|
|
|
47
|
0
|
|
|
0
|
0
|
|
sub render { goto $_[0]->can('render_file') }; |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
1; |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
__END__ |