# Pluggined MooseX::Getopt::Parser parser
has parser => (
- is => 'rw',
- does => 'MooseX::Getopt::Parser',
+ is => 'rw',
+ does => 'MooseX::Getopt::Parser',
default => sub { $_[0]->_default_getopt_parser->new },
);
# Filter for classes which are searched for getopt trait
has classes_filter => (
- is => 'rw',
- isa => 'CodeRef',
- default => sub { sub { 1 } },
+ is => 'rw',
+ isa => 'CodeRef',
+ default => sub { sub { 1; } },
);
# Original @ARGV values
has ARGV => (
- is => 'rw',
- isa => 'ArrayRef[Str]',
- default => sub { [ @ARGV ] },
+ is => 'rw',
+ isa => 'ArrayRef[Str]',
+ default => sub { [@ARGV] },
);
# Unrecognized @ARGV values
has extra_argv => (
- is => 'rw',
- isa => 'ArrayRef[Str]',
+ is => 'rw',
+ isa => 'ArrayRef[Str]',
default => sub { [] },
);
# Hash with options parsed from argv
has options => (
- is => 'rw',
- isa => 'HashRef',
+ is => 'rw',
+ isa => 'HashRef',
default => sub { {} },
);
# Status returned by Getopt parser
has status => (
- is => 'rw',
- isa => 'Bool',
+ is => 'rw',
+ isa => 'Bool',
predicate => 'has_status',
);
my @attrs = map { $_->_compute_getopt_attrs } $self->_compute_getopt_classes;
return $self->parser->build_options( $self, @attrs );
-}
+};
sub _compute_getopt_classes {
sub _get_cmd_flags_for_attr {
- my ($self, $attr) = @_;
+ my ( $self, $attr ) = @_;
my $flag = $attr->name;
my @aliases;
- if ($attr->does('MooseX::Getopt::Meta::Attribute::Trait')) {
- $flag = $attr->cmd_flag if $attr->has_cmd_flag;
+ if ( $attr->does('MooseX::Getopt::Meta::Attribute::Trait') ) {
+ $flag = $attr->cmd_flag if $attr->has_cmd_flag;
@aliases = @{ $attr->cmd_aliases } if $attr->has_cmd_aliases;
};
- return ($flag, @aliases);
+ return ( $flag, @aliases );
};
sub _get_cmd_type_for_attr {
- my ($self, $attr) = @_;
+ my ( $self, $attr ) = @_;
my $type;
$type = $attr->type_constraint if $attr->has_type_constraint;
- if ($attr->does('MooseX::Getopt::Meta::Attribute::Trait')) {
+ if ( $attr->does('MooseX::Getopt::Meta::Attribute::Trait') ) {
$type = $attr->cmd_type if $attr->has_cmd_type;
};
1;
+
__END__
=pod
Yuval Kogman, E<lt>nothingmuch@woobling.orgE<gt>
+Piotr Roszatycki, E<lt>dexter@cpan.orgE<gt>
+
=head1 CONTRIBUTORS
Ryan D Johnson, E<lt>ryan@innerfence.comE<gt>
-Piotr Roszatycki, E<lt>dexter@cpan.orgE<gt>
-
=head1 COPYRIGHT AND LICENSE
Copyright 2007-2008 by Infinity Interactive, Inc.