App-Options
view release on metacpan or search on metacpan
lib/App/Options.pm view on Meta::CPAN
# \.\d(_?\d)*[Ee][\+\-]?(\d(_?\d)*) .34
# 0b[01](_?[01])*
# 0[0-7](_?[0-7])*
# 0x[0-9A-Fa-f](_?[0-9A-Fa-f])*
my ($type);
if ($option_defs) {
@vars = (sort keys %$option_defs);
foreach $var (@vars) {
$type = $option_defs->{$var}{type};
next if (!$type); # nothing to validate against
$value = $values->{$var};
next if (! defined $value);
if ($type eq "integer") {
if ($value !~ /^-?[0-9_]+$/) {
$exit_status = 1;
print "Error: \"$var\" must be of type \"$type\" (not \"$value\")\n";
}
}
elsif ($type eq "float") {
if ($value !~ /^-?[0-9_]+\.?[0-9_]*([eE][+-]?[0-9_]+)?$/ &&
lib/App/Options.pm view on Meta::CPAN
If you really wish to see version information for all
modules, use the --version=all option.
prog --version=all --version_packages=CGI,Template
=head2 Help and Validations
If the "-?" or "--help" options were set on the command line,
the usage statement is printed, and the program is exited.
Then each of the options which is defined may be validated.
If an option is designated as "required", its value must be
defined somewhere (although it may be the empty string).
(If it is also required to be a non-empty string, a regex
may be provided for the type, i.e. type => "/./".)
If an option is designated as having a "type", its value
must either be undefined or match a specific regular expression.
Type Regular Expression
( run in 0.506 second using v1.01-cache-2.11-cpan-a5abf4f5562 )