blib/lib/DTL/Fast/Filter/Lengthis.pm

filter: Statementstmt 100% 22 / 22 Branchbran 75.0% 3 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 2 totaltotal 91.1% 31 / 34 SCAR 11.0
CC
3
Cov
96%
parse_parameters
2.0
filter
2.0
BEGIN
1.0
CRAP 3.0
« blib/lib/DTL/Fast/Filter/Length.pm ↑ Summary blib/lib/DTL/Fast/Tag/Autoescape.pm »
1 package DTL::Fast::Filter::Lengthis;
2 2 ▶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 2 ▶use parent 'DTL::Fast::Filter::Length';
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 2 $DTL::Fast::FILTER_HANDLERS{'length_is'} = __PACKAGE__;
6  
7  
8 #@Override
9 sub parse_parameters
10 {
11 4 ▶ my $self = shift;
Subroutine parse_parameters: called CC=2 SCAR=7.0
Pod undocumented
12 die $self->get_parse_error("no length value specified")
13 4 ▶ if not scalar @{$self->{'parameter'}};
Branch: 1 branch
BranchTrueFalseTotal
unless scalar @{$self->{"parameter"};} 0 4 4
14 4 $self->{'length'} = $self->{'parameter'}->[0];
15 4 return $self;
16 }
17  
18 #@Override
19 sub filter
20 {
21 4 ▶ my( $self, $filter_manager, $value, $context ) = @_;
Subroutine filter: called CC=2 SCAR=6.9
Pod undocumented
22  
23 4 my $length = $self->SUPER::filter($filter_manager, $value, $context);
24 4 ▶ return $length == $self->{'length'}->render($context) ?
Branch: 1 branch
BranchTrueFalseTotal
$length == $self->{'length'}->render($context) ? : 2 2 4
25 1
26 : 0;
27 }
28  
29 2 1;
« blib/lib/DTL/Fast/Filter/Length.pm ↑ Summary blib/lib/DTL/Fast/Tag/Autoescape.pm »