| 1 | package DTL::Fast::Tag::If::Condition; | ||||||||||
| 2 | 8 | ▶ | use strict; use utf8; use warnings FATAL => 'all'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 8 | ▶ | use parent 'DTL::Fast::Renderer'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | # this is a simple condition | ||||||||||
| 5 | |||||||||||
| 6 | 8 | ▶ | use DTL::Fast::Utils qw(as_bool); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | sub new | ||||||||||
| 9 | { | ||||||||||
| 10 | 1489 | ▶ | my( $proto, $condition, %kwargs ) = @_; | ||||||||
|
Subroutine
new: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||
| 11 | |||||||||||
| 12 | 1489 | ▶ | $kwargs{'condition'} = ref $condition ? | ||||||||
|
Branch: 1 branch
| |||||||||||
| 13 | $condition | ||||||||||
| 14 | : DTL::Fast::Expression->new($condition); | ||||||||||
| 15 | |||||||||||
| 16 | 1484 | my $self = $proto->SUPER::new(%kwargs); | |||||||||
| 17 | |||||||||||
| 18 | 1484 | delete $self->{'_template'}; | |||||||||
| 19 | |||||||||||
| 20 | 1484 | return $self; | |||||||||
| 21 | } | ||||||||||
| 22 | |||||||||||
| 23 | sub is_true | ||||||||||
| 24 | { | ||||||||||
| 25 | 2790 | ▶ | my( $self, $context ) = @_; | ||||||||
|
Subroutine
is_true: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 26 | |||||||||||
| 27 | 2790 | return as_bool($self->{'condition'}->render($context)); | |||||||||
| 28 | } | ||||||||||
| 29 | |||||||||||
| 30 | 8 | 1; | |||||||||