Getopt-LL
view release on metacpan or search on metacpan
devel/curversion view on Meta::CPAN
my $version = $META->{version};
if ($options->{'-n'}) {
my $v = version->new($version);
$version = $v->numify;
}
if ($options->{'-i'}) {
my $v = version->new($version);
my @digits = split m/\./, $v->stringify;
$digits[-1]++;
$v = version->new( join q{.}, @digits );
$version = $v->stringify;
}
if ($options->{'-Q'}) {
$version = quotemeta $version;
}
lib/Getopt/LL.pm view on Meta::CPAN
if (ref $rule_spec ne 'HASH') {
$rule_spec = {type => $rule_spec};
}
# If the rule has a help field; save it into help.
if ($rule_spec->{help}) {
$help_ref->{$rule_name} = $rule_spec->{help};
}
my($rule_name_final, @aliases)
= split m/\|/xms, $rule_name;
# Split out the aliases (which are delimited by |)
# Aliases can also be inside the spec, like this:
# '-arg' => { alias => '-gra' };
# or a list of aliases:
# '-arg' => { alias => ['-gra', '-rag', '-rga'] };
#
my $aliases_inside_spec = $rule_spec->{alias};
if ($aliases_inside_spec) {
lib/Getopt/LL.pm view on Meta::CPAN
}
# if find_arg_type said we have a special argument, start processing
# it (as long as processing is not stopped).
elsif ($is_arg_of_type && !$end_processing) {
my @arguments = ($argument);
if ($is_arg_of_type eq 'short' && $options_ref->{split_multiple_shorts}) {
$argument =~ s/^-//xms;
@arguments = map { "-$_" } split m//xms, $argument;
};
for my $argument (@arguments) {
my $argument_name = $argument;
my $argument_value = q{};
# ###
# case: --argument_name=value
# if argument name contains an equal sign, the value is embedded in the
lib/Getopt/LL/Short.pm view on Meta::CPAN
my %RULE_ABBREVATION = (
's' => 'string',
'd' => 'digit',
'f' => 'flag',
);
sub parse_short_rule {
my ($rule) = @_;
if (index ($rule, q{=}) != -1) {
my ($arg_name, $rule_type) = split m/=/xms, $rule, 2;
return ($arg_name, $RULE_ABBREVATION{$rule_type});
}
# Default rule is flag.
return ($rule, 'flag');
}
sub getoptions {
my ($rules_ref, $options_ref, $argv_ref) = @_;
$rules_ref ||= [ ];
( run in 2.202 seconds using v1.01-cache-2.11-cpan-71847e10f99 )