* MooseX::Getopt::Parser::Descriptive: fixed regression: does not require CLI param...
[gitmo/MooseX-Getopt.git] / lib / MooseX / Getopt.pm
index a915d5a..48ea79e 100644 (file)
@@ -48,7 +48,10 @@ sub new_with_options {
 
     my $getopt = defined $params{getopt}
                  ? $params{getopt}
-                 : $class->_default_getopt_session->new;
+                 : $class->_default_getopt_session->new(
+                      classes_filter => sub { $_ eq $class },
+                      params => \%params,
+                  );
 
     my %options = $getopt->options;
 
@@ -56,8 +59,9 @@ sub new_with_options {
         ARGV       => [ $getopt->argv ],        # backward compatibility
         extra_argv => [ $getopt->extra_argv ],  # backward compatibility
         getopt     => $getopt,
-        %params,      # explicit params to ->new
-        %options,     # params from CLI
+        %{ $getopt->params },                   # params from session object
+        %params,                                # explicit params to ->new
+        %options,                               # params from CLI
     );
 };