package MooseX::Getopt::Parser::Long;
+our $VERSION = '0.150001';
+
use Moose;
with 'MooseX::Getopt::Parser';
# Special configuration for parser
has config => (
- is => 'rw',
- isa => 'ArrayRef[Str]',
+ is => 'rw',
+ isa => 'ArrayRef[Str]',
auto_deref => 1,
- default => sub { [] },
+ default => sub { ['default'] },
);
sub build_options {
my $self = shift;
- my ($getopt, @attrs) = @_;
+ my ( $getopt, @attrs ) = @_;
- Moose->throw_error('First argument is not a MooseX::Getopt::Session')
+ Moose->throw_error("First argument is not a MooseX::Getopt::Session")
unless $getopt->isa('MooseX::Getopt::Session');
- my $options = $getopt->options;
+ my $options = $getopt->options;
my $new_options = { %$options };
my @opts;
foreach my $attr (@attrs) {
my $name = $attr->name;
- my ($flag, @aliases) = $getopt->_get_cmd_flags_for_attr($attr);
+ my ( $flag, @aliases ) = $getopt->_get_cmd_flags_for_attr($attr);
my $type = $getopt->_get_cmd_type_for_attr($attr);
my $opt_string = join '|', $flag, @aliases;
- $opt_string .= MooseX::Getopt::OptionTypeMap->get_option_type($type) if $type;
+ $opt_string .= MooseX::Getopt::OptionTypeMap->get_option_type($type)
+ if $type;
$new_options->{$name} = undef;
push @opts, $opt_string => \$new_options->{$name};
local @ARGV = @{ $getopt->ARGV };
local $SIG{__WARN__} = sub {
- return warn @_ if $_[0]=~/^\###/; # Smart::Comments
$warnings .= $_[0];
};
};
# Filter not defined values in new_options hashref
- $new_options = { map { $_ => $new_options->{$_} } grep { defined $new_options->{$_} } keys %$new_options };
+ $new_options = {
+ map { $_ => $new_options->{$_} }
+ grep { defined $new_options->{$_} } keys %$new_options
+ };
$getopt->status( ! $warnings );
$getopt->options( $new_options );
1;
+
__END__
=pod