X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMooseX%2FGetopt%2FSession.pm;fp=lib%2FMooseX%2FGetopt%2FSession.pm;h=e0bfff0cff7a5c7fcb4c36ea5475a851db5317fc;hb=c5c99e6b124174e5f9e56312058f6b302dd5369c;hp=dae6c01e2a726a926c0adcb50adeeb14c0da9278;hpb=70171cea83000f79fe002bf17e531ee50131c9ad;p=gitmo%2FMooseX-Getopt.git diff --git a/lib/MooseX/Getopt/Session.pm b/lib/MooseX/Getopt/Session.pm index dae6c01..e0bfff0 100644 --- a/lib/MooseX/Getopt/Session.pm +++ b/lib/MooseX/Getopt/Session.pm @@ -11,43 +11,43 @@ use constant _default_getopt_parser => 'MooseX::Getopt::Parser::Default'; # 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', ); @@ -58,7 +58,7 @@ sub build_options { my @attrs = map { $_->_compute_getopt_attrs } $self->_compute_getopt_classes; return $self->parser->build_options( $self, @attrs ); -} +}; sub _compute_getopt_classes { @@ -73,29 +73,29 @@ 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; }; @@ -105,6 +105,7 @@ sub _get_cmd_type_for_attr { 1; + __END__ =pod @@ -216,12 +217,12 @@ Brandon L. Black, Eblblack@gmail.comE Yuval Kogman, Enothingmuch@woobling.orgE +Piotr Roszatycki, Edexter@cpan.orgE + =head1 CONTRIBUTORS Ryan D Johnson, Eryan@innerfence.comE -Piotr Roszatycki, Edexter@cpan.orgE - =head1 COPYRIGHT AND LICENSE Copyright 2007-2008 by Infinity Interactive, Inc.