* Add current $VERSION to all files.
[gitmo/MooseX-Getopt.git] / lib / MooseX / Getopt / Parser / Long.pm
index 2914824..9585f8e 100644 (file)
@@ -1,6 +1,8 @@
 
 package MooseX::Getopt::Parser::Long;
 
+our $VERSION   = '0.150001';
+
 use Moose;
 
 with 'MooseX::Getopt::Parser';
@@ -12,21 +14,21 @@ use Getopt::Long ();
 
 # 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;
@@ -34,11 +36,12 @@ sub build_options {
     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};
@@ -53,7 +56,6 @@ sub build_options {
         local @ARGV = @{ $getopt->ARGV };
 
         local $SIG{__WARN__} = sub {
-            return warn @_ if $_[0]=~/^\###/;   # Smart::Comments
             $warnings .= $_[0];
         };
 
@@ -64,7 +66,10 @@ sub build_options {
     };
 
     # 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 );
@@ -77,6 +82,7 @@ sub build_options {
 
 1;
 
+
 __END__
 
 =pod