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
);
}