| 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
| |||||||||||
| 35 | 17 | return int($val); | |||||||||
| 36 | } | ||||||||||
| 37 | ## no critic (ProhibitExplicitReturnUndef) | ||||||||||
| 38 | 1 | return undef; | |||||||||
| 39 | } | ||||||||||
| 40 | |||||||||||
| 41 | 7 | 1; | |||||||||
| 42 | |||||||||||
| 43 | __END__ | ||||||||||