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