Zoidberg
view release on metacpan or search on metacpan
lib/Zoidberg/Utils/GetOpt.pm view on Meta::CPAN
if (exists $conf{$opt}) { $type = $conf{$opt} }
else { error "unrecognized option '$opt'" }
}
push @opts, $opt;
if (! $type) { # no arg
error "option '$opt' doesn't take an argument" if defined $arg;
$opts{$opt} = ($pre eq '+') ? 0 : 1;
}
elsif (ref $type) { # CODE ... for default opts
output $type->( (caller(1))[3], (caller)[0] ); # subroutine, package
error {silent => 1, exit_status => 0}, 'getopt needed to pop stack';
}
else {
$arg = defined($arg) ? $arg : shift(@args);
error "option '$opt' requires an argument" unless defined $arg;
if ($type eq '$') { $opts{$opt} = $arg }
elsif ($type eq '@') {
if (ref $arg) {
error 'argument is not a ARRAY reference'
if ref($arg) ne 'ARRAY';
( run in 1.350 second using v1.01-cache-2.11-cpan-a3c8064c92c )