| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package DTL::Fast::Tag::Ifequal; |
|
2
|
3
|
|
|
3
|
|
2104
|
use strict; use utf8; use warnings FATAL => 'all'; |
|
|
3
|
|
|
3
|
|
6
|
|
|
|
3
|
|
|
3
|
|
79
|
|
|
|
3
|
|
|
|
|
15
|
|
|
|
3
|
|
|
|
|
7
|
|
|
|
3
|
|
|
|
|
118
|
|
|
|
3
|
|
|
|
|
82
|
|
|
|
3
|
|
|
|
|
7
|
|
|
|
3
|
|
|
|
|
115
|
|
|
3
|
3
|
|
|
3
|
|
16
|
use parent 'DTL::Fast::Tag::If'; |
|
|
3
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
27
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
$DTL::Fast::TAG_HANDLERS{'ifequal'} = __PACKAGE__; |
|
6
|
|
|
|
|
|
|
|
|
7
|
3
|
|
|
3
|
|
212
|
use DTL::Fast::Tag::If::Condition; |
|
|
3
|
|
|
|
|
7
|
|
|
|
3
|
|
|
|
|
73
|
|
|
8
|
3
|
|
|
3
|
|
2056
|
use DTL::Fast::Expression::Operator::Binary::Eq; |
|
|
3
|
|
|
|
|
11
|
|
|
|
3
|
|
|
|
|
1331
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
#@Override |
|
11
|
16
|
|
|
16
|
0
|
47
|
sub get_close_tag{ return 'endifequal';} |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
#@Override |
|
14
|
|
|
|
|
|
|
sub parse_parameters |
|
15
|
|
|
|
|
|
|
{ |
|
16
|
32
|
|
|
32
|
0
|
49
|
my $self = shift; |
|
17
|
|
|
|
|
|
|
|
|
18
|
32
|
|
|
|
|
66
|
$self->{'conditions'} = []; |
|
19
|
32
|
|
|
|
|
131
|
my $sources = $self->parse_sources($self->{'parameter'}); |
|
20
|
32
|
|
|
|
|
106
|
return $self->add_main_condition($sources); |
|
21
|
|
|
|
|
|
|
} |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
#@Override |
|
24
|
|
|
|
|
|
|
sub parse_tag_chunk |
|
25
|
|
|
|
|
|
|
{ |
|
26
|
64
|
|
|
64
|
0
|
169
|
my( $self, $tag_name, $tag_param, $chunk_lines ) = @_; |
|
27
|
|
|
|
|
|
|
|
|
28
|
64
|
|
|
|
|
82
|
my $result = undef; |
|
29
|
|
|
|
|
|
|
|
|
30
|
64
|
100
|
|
|
|
141
|
if( $tag_name eq 'else' ) |
|
31
|
|
|
|
|
|
|
{ |
|
32
|
32
|
|
|
|
|
73
|
$self->add_condition(1); |
|
33
|
32
|
|
|
|
|
53
|
$DTL::Fast::Template::CURRENT_TEMPLATE_LINE += $chunk_lines; |
|
34
|
|
|
|
|
|
|
} |
|
35
|
|
|
|
|
|
|
else |
|
36
|
|
|
|
|
|
|
{ |
|
37
|
32
|
|
|
|
|
112
|
$result = $self->SUPER::parse_tag_chunk($tag_name, $tag_param, $chunk_lines); |
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
|
|
40
|
64
|
|
|
|
|
175
|
return $result; |
|
41
|
|
|
|
|
|
|
} |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
#@Override |
|
44
|
|
|
|
|
|
|
sub render |
|
45
|
|
|
|
|
|
|
{ |
|
46
|
32
|
|
|
32
|
0
|
55
|
my $self = shift; |
|
47
|
32
|
|
|
|
|
47
|
my $context = shift; |
|
48
|
32
|
|
|
|
|
47
|
my $result = ''; |
|
49
|
|
|
|
|
|
|
|
|
50
|
32
|
|
|
|
|
45
|
foreach my $condition (@{$self->{'conditions'}}) |
|
|
32
|
|
|
|
|
75
|
|
|
51
|
|
|
|
|
|
|
{ |
|
52
|
48
|
100
|
|
|
|
158
|
if( $condition->is_true($context) ) |
|
53
|
|
|
|
|
|
|
{ |
|
54
|
32
|
|
|
|
|
114
|
$result = $condition->render($context); |
|
55
|
32
|
|
|
|
|
66
|
last; |
|
56
|
|
|
|
|
|
|
} |
|
57
|
|
|
|
|
|
|
} |
|
58
|
32
|
|
|
|
|
181
|
return $result; |
|
59
|
|
|
|
|
|
|
} |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub add_main_condition |
|
62
|
|
|
|
|
|
|
{ |
|
63
|
16
|
|
|
16
|
0
|
22
|
my $self = shift; |
|
64
|
16
|
|
|
|
|
19
|
my $sources = shift; |
|
65
|
16
|
|
|
|
|
19
|
return $self->add_condition(DTL::Fast::Expression::Operator::Binary::Eq->new(@{$sources}[0,1])); |
|
|
16
|
|
|
|
|
69
|
|
|
66
|
|
|
|
|
|
|
} |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
#@Override |
|
69
|
|
|
|
|
|
|
sub add_condition |
|
70
|
|
|
|
|
|
|
{ |
|
71
|
64
|
|
|
64
|
0
|
101
|
my $self = shift; |
|
72
|
64
|
|
|
|
|
96
|
my $condition = shift; |
|
73
|
64
|
|
|
|
|
83
|
push @{$self->{'conditions'}}, DTL::Fast::Tag::If::Condition->new($condition); |
|
|
64
|
|
|
|
|
298
|
|
|
74
|
64
|
|
|
|
|
158
|
return $self; |
|
75
|
|
|
|
|
|
|
} |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
1; |