Term::CLI::Argument::String - class for basic string arguments in Term::CLI
version 0.04008
use Term::CLI::Argument::String; my $arg1 = Term::CLI::Argument::String->new( name => 'arg1' ); $arg1->validate(''); # returns '' $arg1->validate('a'); # returns 'a' $arg1->validate('abcde'); # returns 'abcde' my $arg2 = Term::CLI::Argument::String->new( name => 'arg2' min_length => 1, max_length => 4, ); $arg2->validate(''); # returns undef, sets error $arg2->validate('a'); # returns 'a' $arg2->validate('abcde'); # returns undef, sets error
Simple class for string arguments in Term::CLI(3p). This is basically the Term::CLI::Argument(3p) class, but also allowing empty strings.
Term::CLI::Argument(3p).
None.
See Term::CLI::Argument(3p). Additional attributes are:
The minimum required length for any value.
The maximum lenght allowed for any value.
Inherited from Term::CLI::Argument(3p). Additionally, the following are defined:
Minimum and maximum length for the string, resp.
Booleans, indicate whether min_len and max_len have been set, resp.
min_len
max_len
Clear the min_len and max_len limits, resp.
See Term::CLI::Argument(3p).
Overloaded from Term::CLI::Argument.
Requires the Str value to be defined, and have a length that is between min_len and max_len (if defined).
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.