| 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
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 12 | ▶ | if( | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $digits and $digits =~ /^\d+$/
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+$/
| |||||||||||||||||||||||||||||
| 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; | |||||||||||||||||||||||||||