Term::CLI::Argument::Number - base class for numerical arguments in Term::CLI
version 0.04007
use Term::CLI::Argument::Number; my $arg = Term::CLI::Argument::Number->new( name => 'arg1', min => 1 max => 2 inclusive => 1 );
Base class for numerical arguments in Term::CLI(3p). This class cannot be used directly, but should be extended by sub-classes.
Term::CLI::Argument(3p).
None.
Create a new Term::CLI::Argument::Number object and return a reference to it.
The name attribute is required.
Other attributes that are recognised:
The minimum valid value (by default an inclusive boundary, but see inclusive below.
The maximum valid value (by default an inclusive boundary, but see inclusive below.
Default is 1 (true). Indicates whether minimum/maximum boundaries are inclusive or exclusive.
Inherited from Term::CLI::Argument(3p). Additionally, the following are defined:
Lower and upper boundaries, resp.
Boolean indicating whether the boundaries are inclusive.
Booleans, indicate whether min and max have been set, resp.
min
max
Clear the min and max limits, resp.
Inherited from Term::CLI::Argument(3p).
Additionally:
The validate method uses the coerce_value method to convert VALUE to a suitable number and then checks any boundaries.
This method must be overridden by sub-classes.
It will be called with a single argument (the VALUE) and is supposed to return the converted number. If the number is not valid, it should return undef.
undef
Term::CLI::Argument(3p), Term::CLI(3p).
Steven Bakker <sbakker@cpan.org>, 2018.
Copyright (c) 2018 Steven Bakker
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See "perldoc perlartistic."
This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
To install Term::CLI, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Term::CLI
CPAN shell
perl -MCPAN -e shell install Term::CLI
For more information on module installation, please visit the detailed CPAN module installation guide.