CLI/Argument/Number/Int.pm

filter: Statementstmt 100% 17 / 17 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 100% 1 / 1 totaltotal 100% 25 / 25 CC 2 SCAR 2.9
CC
2
Cov
100%
coerce_value
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.3
« CLI/Base.pm ↑ Summary CLI/Argument/Number/Float.pm »
1 #=============================================================================
2 #
3 # Module: Term::CLI::Argument::Number::Int
4 #
5 # Description: Class for integer arguments in Term::CLI
6 #
7 # Author: Steven Bakker (SBAKKER), <cpanman@monkey-mind.net>
8 # Created: 22/01/18
9 #
10 # Copyright (c) 2018-2022 Steven Bakker
11 #
12 # This module is free software; you can redistribute it and/or modify
13 # it under the same terms as Perl itself. See "perldoc perlartistic."
14 #
15 # This software is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 #
19 #=============================================================================
20  
21 package Term::CLI::Argument::Number::Int 0.061001;
22  
23 7 ▶use 5.014;
Subroutine BEGIN: called CC=1 SCAR=0.0
24 7 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
25  
26 7 ▶use Moo 1.000001;
Subroutine BEGIN: called CC=1 SCAR=0.0
27 7 ▶use namespace::clean 0.25;
Subroutine BEGIN: called CC=1 SCAR=0.0
28  
29 7 extends 'Term::CLI::Argument::Number';
30  
31 18 ▶sub coerce_value {
Subroutine coerce_value: called CC=2 SCAR=6.9
Pod documented
32 18 my ( $self, $val ) = @_;
33  
34 18 ▶ if ( $val =~ /^ [+-]? \d+ $/xsm ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($val =~ /^ [+-]? \d+ $/msux) 17 1 18
35 17 return int($val);
36 }
37 ## no critic (ProhibitExplicitReturnUndef)
38 1 return undef;
39 }
40  
41 7 1;
42  
43 __END__
« CLI/Base.pm ↑ Summary CLI/Argument/Number/Float.pm »