line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Template::Extract; |
2
|
|
|
|
|
|
|
$Template::Extract::VERSION = '0.41'; |
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
26
|
use 5.006; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
30
|
|
5
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
26
|
|
6
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
33
|
|
7
|
1
|
|
|
1
|
|
4
|
use constant RUN_CLASS => ( __PACKAGE__ . '::Run' ); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
62
|
|
8
|
1
|
|
|
1
|
|
4
|
use constant COMPILE_CLASS => ( __PACKAGE__ . '::Compile' ); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
41
|
|
9
|
1
|
|
|
1
|
|
4
|
use constant PARSER_CLASS => ( __PACKAGE__ . '::Parser' ); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
95
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our ( $DEBUG, $EXACT ); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub new { |
14
|
13
|
|
|
13
|
1
|
170
|
my $self = shift; |
15
|
13
|
|
33
|
|
|
67
|
my $class = ref($self) || $self; |
16
|
|
|
|
|
|
|
|
17
|
13
|
|
|
|
|
57
|
my $run_class = $class->RUN_CLASS; |
18
|
13
|
|
|
|
|
45
|
my $compile_class = $class->COMPILE_CLASS; |
19
|
13
|
|
|
|
|
41
|
my $parser_class = $class->PARSER_CLASS; |
20
|
|
|
|
|
|
|
|
21
|
13
|
|
|
|
|
29
|
foreach my $subclass ( $run_class, $compile_class, $parser_class ) { |
22
|
1
|
|
|
1
|
|
5
|
no strict 'refs'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
266
|
|
23
|
39
|
|
|
|
|
97
|
$class->load($subclass); |
24
|
39
|
|
|
|
|
55
|
*{"$subclass\::DEBUG"} = *DEBUG; |
|
39
|
|
|
|
|
177
|
|
25
|
39
|
|
|
|
|
52
|
*{"$subclass\::EXACT"} = *EXACT; |
|
39
|
|
|
|
|
134
|
|
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
bless( |
29
|
|
|
|
|
|
|
{ |
30
|
13
|
|
|
|
|
78
|
run_object => $run_class->new(@_), |
31
|
|
|
|
|
|
|
compile_object => $compile_class->new(@_), |
32
|
|
|
|
|
|
|
parser_object => $parser_class->new(@_), |
33
|
|
|
|
|
|
|
}, |
34
|
|
|
|
|
|
|
$class |
35
|
|
|
|
|
|
|
); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub load { |
39
|
39
|
|
|
39
|
0
|
66
|
my ( $self, $class ) = @_; |
40
|
39
|
|
|
|
|
138
|
$class =~ s{::}{/}g; |
41
|
39
|
|
|
|
|
2126
|
require "$class.pm"; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub extract { |
45
|
12
|
|
|
12
|
1
|
1963
|
my $self = shift; |
46
|
12
|
|
|
|
|
21
|
my $template = shift; |
47
|
|
|
|
|
|
|
|
48
|
12
|
|
|
|
|
45
|
$self->run( $self->compile($template), @_ ); |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub compile { |
52
|
12
|
|
|
12
|
1
|
19
|
my $self = shift; |
53
|
12
|
|
|
|
|
21
|
my $template = shift; |
54
|
12
|
|
|
|
|
63
|
$self->{compile_object}->compile( $template, $self->{parser_object} ); |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub run { |
58
|
12
|
|
|
12
|
1
|
762
|
my $self = shift; |
59
|
12
|
|
|
|
|
64
|
$self->{run_object}->run(@_); |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
1; |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
__END__ |