line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DTL::Fast::Tag::If::Condition; |
2
|
8
|
|
|
8
|
|
47
|
use strict; |
|
8
|
|
|
|
|
15
|
|
|
8
|
|
|
|
|
194
|
|
3
|
8
|
|
|
8
|
|
35
|
use utf8; |
|
8
|
|
|
|
|
16
|
|
|
8
|
|
|
|
|
32
|
|
4
|
8
|
|
|
8
|
|
170
|
use warnings FATAL => 'all'; |
|
8
|
|
|
|
|
18
|
|
|
8
|
|
|
|
|
219
|
|
5
|
8
|
|
|
8
|
|
38
|
use parent 'DTL::Fast::Renderer'; |
|
8
|
|
|
|
|
13
|
|
|
8
|
|
|
|
|
33
|
|
6
|
|
|
|
|
|
|
# this is a simple condition |
7
|
|
|
|
|
|
|
|
8
|
8
|
|
|
8
|
|
426
|
use DTL::Fast::Utils qw(as_bool); |
|
8
|
|
|
|
|
20
|
|
|
8
|
|
|
|
|
1111
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub new |
11
|
|
|
|
|
|
|
{ |
12
|
1489
|
|
|
1489
|
0
|
2888
|
my ( $proto, $condition, %kwargs ) = @_; |
13
|
|
|
|
|
|
|
|
14
|
1489
|
100
|
|
|
|
4626
|
$kwargs{condition} = ref $condition ? |
15
|
|
|
|
|
|
|
$condition |
16
|
|
|
|
|
|
|
: DTL::Fast::Expression->new($condition); |
17
|
|
|
|
|
|
|
|
18
|
1484
|
|
|
|
|
4549
|
my $self = $proto->SUPER::new(%kwargs); |
19
|
|
|
|
|
|
|
|
20
|
1484
|
|
|
|
|
2836
|
delete $self->{_template}; |
21
|
|
|
|
|
|
|
|
22
|
1484
|
|
|
|
|
3462
|
return $self; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub is_true |
26
|
|
|
|
|
|
|
{ |
27
|
2774
|
|
|
2774
|
0
|
4886
|
my ( $self, $context ) = @_; |
28
|
|
|
|
|
|
|
|
29
|
2774
|
|
|
|
|
7923
|
return as_bool($self->{condition}->render($context)); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
1; |