Skip Menu |

This queue is for tickets about the MooseX-Getopt CPAN distribution.

Report information
The Basics
Id: 46200
Status: resolved
Priority: 0/
Queue: MooseX-Getopt

People
Owner: Nobody in particular
Requestors: DOUGDUDE [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in:
  • 0.01
  • 0.02
  • 0.03
  • 0.04
  • 0.05
  • 0.06
  • 0.07
  • 0.08
  • 0.09
  • 0.10
  • 0.11
  • 0.12
  • 0.13
  • 0.14
  • 0.15
  • 0.16
  • 0.17
  • 0.18
Fixed in: (no value)



Subject: new_with_options does not accept HASHREF
In Moose::Object the new() constructor accepts either an array which can be changed into a HASHREF, or a single HASHREF. The new_with_options actually accepts a HASHREF as a single argument, but does not properly pass that on to the new() of the original object. An attached patch to fix this has been included. Example: App->new(length=>2000); # Works App->new({length=>20}); # Works App->new_with_options(length=>2000); # Works App->new_with_options({length=>20}); # Does not work Test: @ARGV = qw(--bar 10); my $foo; lives_ok { $foo = Testing::Foo->new_with_options({baz => 100}); } '... this should work'; isa_ok($foo, 'Testing::Foo'); is($foo->bar, 10, '... got the right values'); is($foo->baz, 100, '... got the right values');
Subject: Getopt.patch
--- Getopt.pm Mon May 18 20:31:09 2009 +++ Getopt.pm Mon May 18 20:31:24 2009 @@ -54,7 +54,7 @@ $class->new( ARGV => $processed{argv_copy}, extra_argv => $processed{argv}, - @params, # explicit params to ->new + %$constructor_params, # explicit params to ->new %$params, # params from CLI ); }
Applied as 69061f7, thanks.