line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DTL::Fast::Tag::If::Condition; |
2
|
8
|
|
|
8
|
|
24
|
use strict; use utf8; use warnings FATAL => 'all'; |
|
8
|
|
|
8
|
|
8
|
|
|
8
|
|
|
8
|
|
160
|
|
|
8
|
|
|
|
|
24
|
|
|
8
|
|
|
|
|
6
|
|
|
8
|
|
|
|
|
37
|
|
|
8
|
|
|
|
|
149
|
|
|
8
|
|
|
|
|
8
|
|
|
8
|
|
|
|
|
223
|
|
3
|
8
|
|
|
8
|
|
20
|
use parent 'DTL::Fast::Renderer'; |
|
8
|
|
|
|
|
9
|
|
|
8
|
|
|
|
|
30
|
|
4
|
|
|
|
|
|
|
# this is a simple condition |
5
|
|
|
|
|
|
|
|
6
|
8
|
|
|
8
|
|
405
|
use DTL::Fast::Utils qw(as_bool); |
|
8
|
|
|
|
|
8
|
|
|
8
|
|
|
|
|
1163
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new |
9
|
|
|
|
|
|
|
{ |
10
|
1489
|
|
|
1489
|
0
|
1560
|
my( $proto, $condition, %kwargs ) = @_; |
11
|
|
|
|
|
|
|
|
12
|
1489
|
100
|
|
|
|
3749
|
$kwargs{'condition'} = ref $condition ? |
13
|
|
|
|
|
|
|
$condition |
14
|
|
|
|
|
|
|
: DTL::Fast::Expression->new($condition); |
15
|
|
|
|
|
|
|
|
16
|
1484
|
|
|
|
|
3534
|
my $self = $proto->SUPER::new(%kwargs); |
17
|
|
|
|
|
|
|
|
18
|
1484
|
|
|
|
|
1672
|
delete $self->{'_template'}; |
19
|
|
|
|
|
|
|
|
20
|
1484
|
|
|
|
|
2579
|
return $self; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub is_true |
24
|
|
|
|
|
|
|
{ |
25
|
2782
|
|
|
2782
|
0
|
2338
|
my( $self, $context ) = @_; |
26
|
|
|
|
|
|
|
|
27
|
2782
|
|
|
|
|
6345
|
return as_bool($self->{'condition'}->render($context)); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
1; |