* Perltidy.
[gitmo/MooseX-Getopt.git] / lib / MooseX / Getopt / Parser / Descriptive.pm
index f90e8e3..cf2a8f3 100644 (file)
@@ -12,49 +12,50 @@ use Getopt::Long::Descriptive ();
 
 # Special configuration for parser
 has config => (
-    is => 'rw',
-    isa => 'ArrayRef[Str]',
-    default => sub { [ 'default' ] },
+    is      => 'rw',
+    isa     => 'ArrayRef[Str]',
+    default => sub { ['default'] },
 );
 
 # Format for usage description
 has format => (
-    is => 'rw',
-    isa => 'Str',
+    is      => 'rw',
+    isa     => 'Str',
     default => 'usage: %c %o',
 );
 
 # Usage object
 has usage => (
-    is => 'rw',
-    isa => 'Maybe[Getopt::Long::Descriptive::Usage]',
+    is        => 'rw',
+    isa       => 'Maybe[Getopt::Long::Descriptive::Usage]',
     predicate => 'has_usage',
 );
 
 
 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 = {};
 
     my $usage;
-    my (@opts, %cmd_flags_to_names);
+    my ( @opts, %cmd_flags_to_names );
 
     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;
 
-        # opt_string is unmangled; parsed options key is mangled
+        # opt_string is unmangled; parsed options keys are mangled
         $flag =~ tr/-/_/;
         $cmd_flags_to_names{$flag} = $name;
 
@@ -85,22 +86,27 @@ sub build_options {
         };
 
         eval {
-            ($new_options, $usage) = Getopt::Long::Descriptive::describe_options(
-                $self->format, @opts, { getopt_conf => $self->config }
-            );
+            ( $new_options, $usage ) =
+                Getopt::Long::Descriptive::describe_options(
+                    $self->format,
+                    @opts,
+                    { getopt_conf => $self->config }
+                );
         };
-        my $e = $@;
-        $warnings .= $e if $e;
+        $warnings .= $@ if $@;
 
         my $extra_argv = \@ARGV;
-        $getopt->extra_argv( $extra_argv );
+        $getopt->extra_argv($extra_argv);
     };
 
     # Store usage object
     $self->usage( $usage );
 
     # Convert cmd_flags back to names in options hashref
-    $new_options = { map { $cmd_flags_to_names{$_} => $new_options->{$_} } keys %$new_options };
+    $new_options = {
+        map { $cmd_flags_to_names{$_} => $new_options->{$_} }
+            keys %$new_options
+    };
 
     # Include old options
     $new_options = { %$options, %$new_options };
@@ -116,6 +122,7 @@ sub build_options {
 
 1;
 
+
 __END__
 
 =pod