| 1 | 18 | ▶ | use v5.26; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 2 | 18 | ▶ | use Object::Pad; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||
| 4 | 18 | ▶ | use Getopt::Pad::Type; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||
| 6 | class Getopt::Pad::Type::Number :isa(Getopt::Pad::Type) :abstract { | ||||||||||||||||||||||||||||||||||||||||||
| 7 | 18 | ▶ | use Scalar::Util qw(looks_like_number); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||
| 9 | 18 | our $VERSION = '0.04'; | |||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||
| 11 | 18 | ▶ | use constant SPEC_KEYS => ['min', 'max']; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||
| 13 | field $min :param :reader = undef; | ||||||||||||||||||||||||||||||||||||||||||
| 14 | 0 | ▶ | field $max :param :reader = undef; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
min: not called CC=1 SCAR=2.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||
| 16 | # A bound that is not a number, or an empty range, is a spec mistake. | ||||||||||||||||||||||||||||||||||||||||||
| 17 | 112 | ▶ | method checkSpecKeys :common (%args) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
checkSpecKeys: called CC=6 SCAR=18.1
Subroutine
max: not called CC=1 SCAR=0.2
Pod
documented
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 18 | 112 | foreach my $bound (grep { defined $args{$_} } qw(min max)) { | |||||||||||||||||||||||||||||||||||||||||
| 19 | 39 | ▶ | return sprintf("%s must be a number, not '%s'", $bound, $args{$bound}) if !looks_like_number($args{$bound}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 20 | } | ||||||||||||||||||||||||||||||||||||||||||
| 21 | 111 | ▶ | return sprintf("min %s is larger than max %s", $args{min}, $args{max}) if defined $args{min} && defined $args{max} && $args{min} > $args{max}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
defined $args{"min"} and defined $args{"max"} and $args{"min"} > $args{"max"}
defined $args{"min"} and defined $args{"max"}
MC/DC66%2/3
defined $args{"min"} and defined $args{"max"} and $args{"min"} > $args{"max"}
defined $args{"min"}
defined $args{"max"}
$args{"min"} > $args{"max"}
Truth table75%3/4
A and B and C
A= defined $args{"min"}B= defined $args{"max"}C= $args{"min"} > $args{"max"}
| |||||||||||||||||||||||||||||||||||||||||||
| 22 | 110 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 23 | 18 | } | |||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||
| 25 | 137 | ▶ | method glSuffix() { return '=s' } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
glSuffix: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||
| 27 | 18 | method checkFormat($value); | |||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||
| 29 | 29 | ▶ | method coerce($value) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
coerce: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 30 | 29 | return $value + 0; | |||||||||||||||||||||||||||||||||||||||||
| 31 | 18 | } | |||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||
| 33 | 47 | ▶ | method check($value) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
check: called CC=6 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 34 | 47 | my $problem = $self->checkFormat($value); | |||||||||||||||||||||||||||||||||||||||||
| 35 | 47 | ▶ | return $problem if defined $problem; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 36 | 33 | ▶ | return sprintf('%s is smaller than the minimum of %s', $value, $min) if defined $min && $value < $min; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $min and $value < $min
MC/DC100%2/2
defined $min and $value < $min
defined $min
$value < $min
Truth table100%3/3
A and B
A= defined $minB= $value < $min
| |||||||||||||||||||||||||||||||||||||||||||
| 37 | 31 | ▶ | return sprintf('%s is larger than the maximum of %s', $value, $max) if defined $max && $value > $max; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $max and $value > $max
MC/DC100%2/2
defined $max and $value > $max
defined $max
$value > $max
Truth table100%3/3
A and B
A= defined $maxB= $value > $max
| |||||||||||||||||||||||||||||||||||||||||||
| 38 | 30 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 39 | 18 | } | |||||||||||||||||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||
| 42 | 18 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||
| 44 | __END__ | ||||||||||||||||||||||||||||||||||||||||||