Term::CLI::Argument - generic parent class for arguments in Term::CLI
version 0.04008
use Term::CLI::Argument; my $arg = Term::CLI::Argument->new(name => 'varname');
Generic parent class for arguments in Term::CLI(3p). Inherits from M6::CLI::Element(3p).
Term::CLI::Element(3p).
None.
Create a new Term::CLI::Argument object and return a reference to it.
The name attribute is required.
Other possible attributes are:
The minimal number of times the argument must occur. A negative or zero value means there is no minimum.
The default is 1.
1
The maximum number of times the argument may occur. A negative or zero value means there is no maximum.
A shortcut to setting min_occur and max_occur to the same value. Specifying this will override any min_occur or max_occur attributes.
min_occur
max_occur
Accessors are inherited from Term::CLI::Element(3p).
Additionally, there are the following:
Get or set the min_occur attribute.
Get or set the max_occur attribute.
When called with no arguments, returns two-element list containing the min_occur and max_occur values, resp.
When called with one argument, it will set both the min_occur and max_occur attributes to the given value.
Return the argument "type". By default, this is the object's class name with the M6::CLI::Argument:: prefix removed. Can be overloaded to provide a different value.
M6::CLI::Argument::
Check whether value is a valid value for this object. Return the (possibly normalised) value if it is, nothing (i.e. undef or the empty list, depending on call context) if it is not (and set the error() attribute).
undef
By default, this method only checks whether value is defined and not an empty string.
Sub-classes should probably override this.
Term::CLI::Argument::String(3p), Term::CLI::Argument::Number(3p), Term::CLI::Argument::Enum(3p), Term::CLI::Argument::Filename(3p), Term::CLI::Element(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.