line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DTL::Fast::Tag::If::Condition; |
2
|
8
|
|
|
8
|
|
43
|
use strict; use utf8; use warnings FATAL => 'all'; |
|
8
|
|
|
8
|
|
15
|
|
|
8
|
|
|
8
|
|
214
|
|
|
8
|
|
|
|
|
44
|
|
|
8
|
|
|
|
|
12
|
|
|
8
|
|
|
|
|
45
|
|
|
8
|
|
|
|
|
201
|
|
|
8
|
|
|
|
|
17
|
|
|
8
|
|
|
|
|
278
|
|
3
|
8
|
|
|
8
|
|
40
|
use parent 'DTL::Fast::Renderer'; |
|
8
|
|
|
|
|
13
|
|
|
8
|
|
|
|
|
51
|
|
4
|
|
|
|
|
|
|
# this is a simple condition |
5
|
|
|
|
|
|
|
|
6
|
8
|
|
|
8
|
|
484
|
use DTL::Fast::Utils qw(as_bool); |
|
8
|
|
|
|
|
21
|
|
|
8
|
|
|
|
|
1746
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new |
9
|
|
|
|
|
|
|
{ |
10
|
1489
|
|
|
1489
|
0
|
2726
|
my( $proto, $condition, %kwargs ) = @_; |
11
|
|
|
|
|
|
|
|
12
|
1489
|
100
|
|
|
|
5157
|
$kwargs{'condition'} = ref $condition ? |
13
|
|
|
|
|
|
|
$condition |
14
|
|
|
|
|
|
|
: DTL::Fast::Expression->new($condition); |
15
|
|
|
|
|
|
|
|
16
|
1484
|
|
|
|
|
4981
|
my $self = $proto->SUPER::new(%kwargs); |
17
|
|
|
|
|
|
|
|
18
|
1484
|
|
|
|
|
3028
|
delete $self->{'_template'}; |
19
|
|
|
|
|
|
|
|
20
|
1484
|
|
|
|
|
4274
|
return $self; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub is_true |
24
|
|
|
|
|
|
|
{ |
25
|
2826
|
|
|
2826
|
0
|
3977
|
my( $self, $context ) = @_; |
26
|
|
|
|
|
|
|
|
27
|
2826
|
|
|
|
|
8934
|
return as_bool($self->{'condition'}->render($context)); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
1; |