- CLASS STRUCTURE
- SEE ALSO
- COPYRIGHT AND LICENSE
Term::CLI::Argument::Number - base class for numerical arguments in Term::CLI
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.
- new ( name => VARNAME, ... )
Create a new Term::CLI::Argument::Number object and return a reference to it.
The name attribute is required.
Other attributes that are recognised:
- min => NUM
The minimum valid value (by default an inclusive boundary, but see inclusive below.
- max => NUM
The maximum valid value (by default an inclusive boundary, but see inclusive below.
- inclusive => BOOLEAN
Default is 1 (true). Indicates whether minimum/maximum boundaries are inclusive or exclusive.
Inherited from Term::CLI::Argument(3p). Additionally, the following are defined:
- min ( NUMBER )
- max ( NUMBER )
Lower and upper boundaries, resp.
- inclusive ( BOOL )
Boolean indicating whether the boundaries are inclusive.
Booleans, indicate whether
maxhave been set, resp.
Inherited from Term::CLI::Argument(3p).
- validate ( VALUE )
- coerce_value ( VALUE )
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
Steven Bakker <firstname.lastname@example.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.