| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package HTML::Template::Compiled::Expression; |
|
2
|
36
|
|
|
36
|
|
131
|
use strict; |
|
|
36
|
|
|
|
|
35
|
|
|
|
36
|
|
|
|
|
867
|
|
|
3
|
36
|
|
|
36
|
|
106
|
use warnings; |
|
|
36
|
|
|
|
|
34
|
|
|
|
36
|
|
|
|
|
741
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
36
|
|
|
36
|
|
105
|
use constant OPERANDS => 0; |
|
|
36
|
|
|
|
|
32
|
|
|
|
36
|
|
|
|
|
1799
|
|
|
6
|
36
|
|
|
36
|
|
123
|
use constant ATTRIBUTES => 1; |
|
|
36
|
|
|
|
|
46
|
|
|
|
36
|
|
|
|
|
1317
|
|
|
7
|
36
|
|
|
36
|
|
128
|
use base 'Exporter'; |
|
|
36
|
|
|
|
|
45
|
|
|
|
36
|
|
|
|
|
2834
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '1.003'; # VERSION |
|
9
|
36
|
|
|
36
|
|
12917
|
use HTML::Template::Compiled::Expression::Expressions; |
|
|
36
|
|
|
|
|
56
|
|
|
|
36
|
|
|
|
|
11165
|
|
|
10
|
|
|
|
|
|
|
my @expressions = qw( |
|
11
|
|
|
|
|
|
|
&_expr_literal |
|
12
|
|
|
|
|
|
|
&_expr_defined |
|
13
|
|
|
|
|
|
|
&_expr_ternary |
|
14
|
|
|
|
|
|
|
&_expr_function |
|
15
|
|
|
|
|
|
|
&_expr_method |
|
16
|
|
|
|
|
|
|
&_expr_elsif |
|
17
|
|
|
|
|
|
|
); |
|
18
|
|
|
|
|
|
|
our @EXPORT_OK = @expressions; |
|
19
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( |
|
20
|
|
|
|
|
|
|
expressions => \@expressions, |
|
21
|
|
|
|
|
|
|
); |
|
22
|
|
|
|
|
|
|
|
|
23
|
10
|
|
|
10
|
|
98
|
sub _expr_literal { HTML::Template::Compiled::Expression::Literal->new(@_) } |
|
24
|
4
|
|
|
4
|
|
39
|
sub _expr_defined { HTML::Template::Compiled::Expression::Defined->new(@_) } |
|
25
|
4
|
|
|
4
|
|
25
|
sub _expr_ternary { HTML::Template::Compiled::Expression::Ternary->new(@_) } |
|
26
|
10
|
|
|
10
|
|
82
|
sub _expr_function { HTML::Template::Compiled::Expression::Function->new(@_) } |
|
27
|
9
|
|
|
9
|
|
67
|
sub _expr_method { HTML::Template::Compiled::Expression::Method->new(@_) } |
|
28
|
7
|
|
|
7
|
|
42
|
sub _expr_elsif { HTML::Template::Compiled::Expression::Elsif->new(@_) } |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub new { |
|
32
|
48
|
|
|
48
|
0
|
54
|
my $class = shift; |
|
33
|
48
|
|
|
|
|
95
|
my $self = [ [], {} ]; |
|
34
|
48
|
|
|
|
|
63
|
bless $self, $class; |
|
35
|
48
|
|
|
|
|
135
|
$self->init(@_); |
|
36
|
48
|
|
|
|
|
128
|
return $self; |
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
0
|
0
|
|
sub init {} |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub set_operands { |
|
42
|
48
|
|
|
48
|
0
|
147
|
$_[0]->[OPERANDS] = $_[1]; |
|
43
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub get_operands { |
|
46
|
|
|
|
|
|
|
return wantarray |
|
47
|
48
|
50
|
|
48
|
0
|
86
|
? @{ $_[0]->[OPERANDS] } |
|
|
48
|
|
|
|
|
118
|
|
|
48
|
|
|
|
|
|
|
: $_[0]->[OPERANDS]; |
|
49
|
|
|
|
|
|
|
} |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub set_attributes { |
|
52
|
0
|
|
|
0
|
0
|
0
|
$_[0]->[ATTRIBUTES] = $_[1]; |
|
53
|
|
|
|
|
|
|
} |
|
54
|
|
|
|
|
|
|
|
|
55
|
0
|
|
|
0
|
0
|
0
|
sub get_attributes { return $_[0]->[ATTRIBUTES] } |
|
56
|
|
|
|
|
|
|
|
|
57
|
0
|
|
|
0
|
0
|
0
|
sub to_string { print "$_[0] to_string\n" } |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub level2indent { |
|
60
|
34
|
|
|
34
|
0
|
38
|
my ($self, $level) = @_; |
|
61
|
36
|
|
|
36
|
|
179
|
no warnings; |
|
|
36
|
|
|
|
|
46
|
|
|
|
36
|
|
|
|
|
1976
|
|
|
62
|
34
|
|
|
|
|
80
|
return " " x $level; |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
package HTML::Template::Compiled::Expression::Conditional; |
|
67
|
36
|
|
|
36
|
|
117
|
use base qw(HTML::Template::Compiled::Expression); |
|
|
36
|
|
|
|
|
37
|
|
|
|
36
|
|
|
|
|
16605
|
|
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub init { |
|
70
|
7
|
|
|
7
|
|
10
|
my ($self, $op) = @_; |
|
71
|
7
|
|
|
|
|
22
|
$self->set_operands([$op]); |
|
72
|
|
|
|
|
|
|
} |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
package HTML::Template::Compiled::Expression::Elsif; |
|
75
|
|
|
|
|
|
|
our @ISA = qw(HTML::Template::Compiled::Expression::Conditional); |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub to_string { |
|
78
|
7
|
|
|
7
|
|
10
|
my ($self, $level) = @_; |
|
79
|
7
|
|
|
|
|
25
|
my $indent = $self->level2indent($level); |
|
80
|
7
|
|
|
|
|
25
|
my ($op) = $self->get_operands; |
|
81
|
7
|
|
|
|
|
36
|
return $indent . '}' . $/ . $indent . 'elsif ( ' . $op->to_string . ' ) {'; |
|
82
|
|
|
|
|
|
|
} |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
package HTML::Template::Compiled::Expression::SubrefCall; |
|
85
|
|
|
|
|
|
|
our @ISA = qw(HTML::Template::Compiled::Expression); |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub init { |
|
88
|
4
|
|
|
4
|
|
5
|
my ($self, @ops) = @_; |
|
89
|
4
|
|
|
|
|
12
|
$self->set_operands([@ops]); |
|
90
|
|
|
|
|
|
|
} |
|
91
|
|
|
|
|
|
|
sub to_string { |
|
92
|
4
|
|
|
4
|
|
5
|
my ($self, $level) = @_; |
|
93
|
4
|
|
|
|
|
16
|
my $indent = $self->level2indent($level); |
|
94
|
4
|
|
|
|
|
15
|
my ($subref, @ops) = $self->get_operands; |
|
95
|
|
|
|
|
|
|
my @strings = map { |
|
96
|
4
|
50
|
|
|
|
5
|
ref $_ ? $_->to_string($level) : $_ |
|
|
4
|
|
|
|
|
12
|
|
|
97
|
|
|
|
|
|
|
} @ops; |
|
98
|
4
|
|
|
|
|
26
|
return "$indent$subref->( " . (join ',', @strings). ')'; |
|
99
|
|
|
|
|
|
|
} |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
package HTML::Template::Compiled::Expression::Function; |
|
102
|
|
|
|
|
|
|
our @ISA = qw(HTML::Template::Compiled::Expression); |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
sub init { |
|
105
|
19
|
|
|
19
|
|
39
|
my ($self, @ops) = @_; |
|
106
|
19
|
|
|
|
|
78
|
$self->set_operands([@ops]); |
|
107
|
|
|
|
|
|
|
} |
|
108
|
|
|
|
|
|
|
sub to_string { |
|
109
|
10
|
|
|
10
|
|
14
|
my ($self, $level) = @_; |
|
110
|
10
|
|
|
|
|
30
|
my $indent = $self->level2indent($level); |
|
111
|
10
|
|
|
|
|
41
|
my ($function, @ops) = $self->get_operands; |
|
112
|
|
|
|
|
|
|
my @strings = map { |
|
113
|
10
|
100
|
|
|
|
17
|
ref $_ ? $_->to_string($level) : $_ |
|
|
10
|
|
|
|
|
42
|
|
|
114
|
|
|
|
|
|
|
} @ops; |
|
115
|
10
|
|
|
|
|
104
|
return "$indent$function( " . (join ',', @strings). ')'; |
|
116
|
|
|
|
|
|
|
} |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
package HTML::Template::Compiled::Expression::Method; |
|
119
|
|
|
|
|
|
|
our @ISA = qw(HTML::Template::Compiled::Expression::Function); |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
sub to_string { |
|
122
|
9
|
|
|
9
|
|
11
|
my ($self, $level) = @_; |
|
123
|
9
|
|
|
|
|
28
|
my $indent = $self->level2indent($level); |
|
124
|
9
|
|
|
|
|
26
|
my ($function, $object, @args) = $self->get_operands; |
|
125
|
9
|
100
|
|
|
|
39
|
my $start = $indent . (ref $object ? $object->to_string($level) : $object) |
|
126
|
|
|
|
|
|
|
. "->$function( "; |
|
127
|
|
|
|
|
|
|
my @strings = map { |
|
128
|
9
|
50
|
|
|
|
11
|
ref $_ ? $_->to_string($level) : $_ |
|
|
9
|
|
|
|
|
29
|
|
|
129
|
|
|
|
|
|
|
} @args; |
|
130
|
9
|
|
|
|
|
51
|
return $start . (join ',', @strings). ')'; |
|
131
|
|
|
|
|
|
|
} |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
1; |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
__END__ |