| 1 | #============================================================================= | ||||||||||
| 2 | # | ||||||||||
| 3 | # Module: Term::CLI::Argument::Number::Float | ||||||||||
| 4 | # | ||||||||||
| 5 | # Description: Class for floating point 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::Float 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 Scalar::Util 1.23 qw( looks_like_number ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 27 | |||||||||||
| 28 | 7 | ▶ | use Moo 1.000001; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 29 | 7 | ▶ | use namespace::clean 0.25; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 30 | |||||||||||
| 31 | 7 | extends 'Term::CLI::Argument::Number'; | |||||||||
| 32 | |||||||||||
| 33 | 10 | ▶ | sub coerce_value { | ||||||||
|
Subroutine
coerce_value: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 34 | 10 | my ( $self, $arg ) = @_; | |||||||||
| 35 | 10 | ▶ | if ( looks_like_number($arg) ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 36 | 9 | return $arg + 0.0; | |||||||||
| 37 | } | ||||||||||
| 38 | ## no critic (ProhibitExplicitReturnUndef) | ||||||||||
| 39 | 1 | return undef; | |||||||||
| 40 | } | ||||||||||
| 41 | |||||||||||
| 42 | 7 | 1; | |||||||||
| 43 | |||||||||||
| 44 | __END__ | ||||||||||