Term::CLI::Argument::TypeTiny - class for Type::Tiny validated arguments in Term::CLI
version 0.059000
use Term::CLI::Argument::TypeTiny; use Types::Standard qw( ArrayRef Split ); use Types::Common::String qw( NonEmptyStr ); # accept a comma separated list of strings, split them and return an array my $arg = Term::CLI::Argument::TypeTiny->new( name => 'arg1', typetiny => ArrayRef->of(NonEmptyStr)->plus_coercions(Split[qr/,/]), coerce => 1, );
Class for Type::Tiny validated arguments in Term::CLI(3p).
This class inherits from the Term::CLI::Argument(3p) class.
Term::CLI::Argument(3p).
None.
OBJ = Term::CLI::Argument::TypeTiny( name => STRING, typetiny => InstanceOf['Type::Tiny'], coerce => Bool, );
See also Term::CLI::Argument(3p). The typetiny argument is mandatory and must be a Type::Tiny(3p) object. It will be used to validate values.
If coerce is true, validate will call the Type::Tiny object's coercion method to coerce the input value.
See also Term::CLI::Argument(3p).
The Type::Tiny object which will validate values.
Boolean that indicates whether validate will call the Type::Tiny object's coercion method to coerce the input value.
The following methods are added or overloaded:
Overloaded from Term::CLI::Argument(3p).
Only allow positive or zero numbers for # of zombies seen. Allow non integers, in case they've lost bits and pieces:
use Types::Common::Numeric qw( PositiveOrZeroNum); my $arg = Term::CLI::Argument::TypeTiny( name => 'zombies', typetiny => PositiveOrZeroNum );
Accept a URI, convert to a URI object:
use Types::URI 'URI'; my $arg = Term::CLI::Argument::TypeTiny( name => 'uri', typetiny => URI, coerce => 1 );
Accept a file which must exist, convert to a Path::Tiny object:
use Types::Path::Tiny 'File'; my $arg = Term::CLI::Argument::TypeTiny( name => 'file', typetiny => File, coerce => 1 );
Term::CLI::Argument(3p), Term::CLI(3p), Type::Tiny(3p).
Diab Jerius <djerius@cpan.org>, 2022.
Copyright (c) 2022 Diab Jerius, Smithsonian Astrophysical Observatory
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.