blib/lib/DTL/Fast/Tag/If/Condition.pm

filter: Statementstmt 100% 23 / 23 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 0.0% 0 / 2 totaltotal 94.1% 32 / 34 SCAR 6.9
CC
2
Cov
100%
new
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.0
« blib/lib/DTL/Fast/Filter/Linebreaks.pm ↑ Summary blib/lib/DTL/Fast/Tag/Debug.pm »
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
BranchTrueFalseTotal
ref $condition ? : 32 1457 1489
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;
« blib/lib/DTL/Fast/Filter/Linebreaks.pm ↑ Summary blib/lib/DTL/Fast/Tag/Debug.pm »