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

filter: Statementstmt 100% 26 / 26 Branchbran 100% 6 / 6 Conditioncond 66.6% 2 / 3 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 2 totaltotal 91.1% 41 / 45 SCAR 16.1
CC
5
Cov
97%
filter
4.0
parse_parameters
2.0
BEGIN
1.0
CRAP 5.0
« blib/lib/DTL/Fast/Filter/Pluralize.pm ↑ Summary blib/lib/DTL/Fast/Filter/Wordwrap.pm »
1 package DTL::Fast::Filter::Floatformat;
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';
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 2 $DTL::Fast::FILTER_HANDLERS{'floatformat'} = __PACKAGE__;
6  
7 #@Override
8 sub parse_parameters
9 {
10 12 ▶ my $self = shift;
Subroutine parse_parameters: called CC=2 SCAR=6.9
Pod undocumented
11 $self->{'digits'} = $self->{'parameter'}->[0]
12 12 ▶ if scalar @{$self->{'parameter'}};
Branch: 1 branch
BranchTrueFalseTotal
if scalar @{$self->{"parameter"};} 8 4 12
13 12 return $self;
14 }
15  
16 #@Override
17 sub filter
18 {
19 12 ▶ my $self = shift; # self
Subroutine filter: called CC=4 SCAR=13.9
Pod undocumented
20 12 shift; # filter_manager
21 12 my $value = shift;
22 12 my $context = shift;
23  
24 12 ▶ my $digits = defined $self->{'digits'} ? $self->{'digits'}->render($context) : undef;
Branch: 1 branch
BranchTrueFalseTotal
defined $self->{'digits'} ? : 8 4 12
25
26 12 ▶ if(
Branch: 1 branch
BranchTrueFalseTotal
if (defined $digits and $digits =~ /^\d+$/) 8 4 12
Condition66%2/3
defined $digits and $digits =~ /^\d+$/
!ll&&!rl&&r
408
MC/DC50%1/2
defined $digits and $digits =~ /^\d+$/
defined $digits $digits =~ /^\d+$/
Truth table66%2/3
A and B
A= defined $digitsB= $digits =~ /^\d+$/
ABresult
0X0
100
111
27 defined $digits
28 and $digits =~ /^\d+$/
29 )
30 {
31 8 $value = sprintf "%.0${digits}f", $value;
32 }
33
34 12 return $value;
35 }
36  
37 2 1;
« blib/lib/DTL/Fast/Filter/Pluralize.pm ↑ Summary blib/lib/DTL/Fast/Filter/Wordwrap.pm »