Commandable
view release on metacpan or search on metacpan
lib/Commandable/Command.pm view on Meta::CPAN
if( $args{name} =~ s/([=:])(.+?)$/$1/ ) {
# Convert a type abbreviation
my $typespec = $typespecs{$2} or
die "Unrecognised typespec $2";
( $args{match_msg}, $args{matches} ) = @$typespec;
}
$args{mode} = "value" if $args{name} =~ s/[=:]$//;
$args{mode} = "multi_value" if $args{multi};
my @names = split m/\|/, delete $args{name};
$args{mode} //= "set";
$args{negatable} //= 1 if $args{mode} eq "bool";
bless [ \@names, @args{qw( description mode default negatable matches match_msg )} ], $class;
}
sub name { shift->[0]->[0] }
sub keyname { shift->name =~ s/-/_/gr }
sub names { shift->[0]->@* }
sub description { shift->[1] }
sub mode { shift->[2] }
( run in 0.458 second using v1.01-cache-2.11-cpan-483215c6ad5 )