| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package DTL::Fast::Tag::If; |
|
2
|
8
|
|
|
8
|
|
3245
|
use strict; |
|
|
8
|
|
|
|
|
16
|
|
|
|
8
|
|
|
|
|
185
|
|
|
3
|
8
|
|
|
8
|
|
33
|
use utf8; |
|
|
8
|
|
|
|
|
14
|
|
|
|
8
|
|
|
|
|
131
|
|
|
4
|
8
|
|
|
8
|
|
176
|
use warnings FATAL => 'all'; |
|
|
8
|
|
|
|
|
15
|
|
|
|
8
|
|
|
|
|
250
|
|
|
5
|
8
|
|
|
8
|
|
36
|
use parent 'DTL::Fast::Tag'; |
|
|
8
|
|
|
|
|
14
|
|
|
|
8
|
|
|
|
|
52
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
$DTL::Fast::TAG_HANDLERS{if} = __PACKAGE__; |
|
8
|
|
|
|
|
|
|
|
|
9
|
8
|
|
|
8
|
|
3336
|
use DTL::Fast::Tag::If::Condition; |
|
|
8
|
|
|
|
|
20
|
|
|
|
8
|
|
|
|
|
2143
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
#@Override |
|
12
|
757
|
|
|
757
|
0
|
1926
|
sub get_close_tag { return 'endif';} |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
#@Override |
|
15
|
|
|
|
|
|
|
sub parse_parameters |
|
16
|
|
|
|
|
|
|
{ |
|
17
|
531
|
|
|
531
|
0
|
884
|
my ( $self ) = @_; |
|
18
|
|
|
|
|
|
|
|
|
19
|
531
|
|
|
|
|
853
|
$self->{conditions} = [ ]; |
|
20
|
531
|
|
|
|
|
1325
|
$self->add_condition($self->{parameter}); |
|
21
|
|
|
|
|
|
|
|
|
22
|
526
|
|
|
|
|
949
|
return $self; |
|
23
|
|
|
|
|
|
|
} |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
#@Override |
|
26
|
|
|
|
|
|
|
sub add_chunk |
|
27
|
|
|
|
|
|
|
{ |
|
28
|
3448
|
|
|
3448
|
0
|
5697
|
my ( $self, $chunk ) = @_; |
|
29
|
|
|
|
|
|
|
|
|
30
|
3448
|
|
|
|
|
8828
|
$self->{conditions}->[- 1]->add_chunk($chunk); |
|
31
|
3448
|
|
|
|
|
6003
|
return $self; |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
#@Override |
|
35
|
|
|
|
|
|
|
sub parse_tag_chunk |
|
36
|
|
|
|
|
|
|
{ |
|
37
|
1683
|
|
|
1683
|
0
|
3987
|
my ( $self, $tag_name, $tag_param, $chunk_lines ) = @_; |
|
38
|
|
|
|
|
|
|
|
|
39
|
1683
|
|
|
|
|
2596
|
my $result = undef; |
|
40
|
|
|
|
|
|
|
|
|
41
|
1683
|
100
|
100
|
|
|
6841
|
if ($tag_name eq 'elif' or $tag_name eq 'elsif') |
|
|
|
100
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
{ |
|
43
|
420
|
|
|
|
|
923
|
$self->add_condition($tag_param); |
|
44
|
420
|
|
|
|
|
636
|
$DTL::Fast::Template::CURRENT_TEMPLATE_LINE += $chunk_lines; |
|
45
|
|
|
|
|
|
|
} |
|
46
|
|
|
|
|
|
|
elsif ($tag_name eq 'else') |
|
47
|
|
|
|
|
|
|
{ |
|
48
|
474
|
|
|
|
|
1090
|
$self->add_condition(1); |
|
49
|
474
|
|
|
|
|
681
|
$DTL::Fast::Template::CURRENT_TEMPLATE_LINE += $chunk_lines; |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
else |
|
52
|
|
|
|
|
|
|
{ |
|
53
|
789
|
|
|
|
|
2169
|
$result = $self->SUPER::parse_tag_chunk($tag_name, $tag_param, $chunk_lines); |
|
54
|
|
|
|
|
|
|
} |
|
55
|
|
|
|
|
|
|
|
|
56
|
1667
|
|
|
|
|
3365
|
return $result; |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
#@Override |
|
60
|
|
|
|
|
|
|
sub render |
|
61
|
|
|
|
|
|
|
{ |
|
62
|
1786
|
|
|
1786
|
0
|
3206
|
my ( $self, $context ) = @_; |
|
63
|
|
|
|
|
|
|
|
|
64
|
1786
|
|
|
|
|
2706
|
my $result = ''; |
|
65
|
|
|
|
|
|
|
|
|
66
|
1786
|
|
|
|
|
2391
|
foreach my $condition (@{$self->{conditions}}) |
|
|
1786
|
|
|
|
|
3334
|
|
|
67
|
|
|
|
|
|
|
{ |
|
68
|
2726
|
100
|
|
|
|
6745
|
if ($condition->is_true($context)) |
|
69
|
|
|
|
|
|
|
{ |
|
70
|
1774
|
|
|
|
|
4730
|
$result = $condition->render($context); |
|
71
|
1770
|
|
|
|
|
3111
|
last; |
|
72
|
|
|
|
|
|
|
} |
|
73
|
|
|
|
|
|
|
} |
|
74
|
1779
|
|
|
|
|
5823
|
return $result; |
|
75
|
|
|
|
|
|
|
} |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub add_condition |
|
78
|
|
|
|
|
|
|
{ |
|
79
|
1425
|
|
|
1425
|
0
|
2336
|
my ( $self, $condition ) = @_; |
|
80
|
1425
|
|
|
|
|
1917
|
push @{$self->{conditions}}, DTL::Fast::Tag::If::Condition->new($condition); |
|
|
1425
|
|
|
|
|
3924
|
|
|
81
|
1420
|
|
|
|
|
2215
|
return $self; |
|
82
|
|
|
|
|
|
|
} |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
1; |