+ - make Method::Generate::Constructor handle $obj->new
- fix bug where constants containing a reference weren't handled correctly
(ref(\[]) is 'REF' not 'SCALAR', ref(\v1) is 'VSTRING')
$spec->{$no_init}{init_arg} = $no_init;
}
local $self->{captures} = {};
- my $body = ' my $class = shift;'."\n";
+ my $body = ' my $class = shift;'."\n"
+ .' $class = ref($class) if ref($class);'."\n";
$body .= $self->_handle_subconstructor($into, $name);
my $into_buildargs = $into->can('BUILDARGS');
if ( $into_buildargs && $into_buildargs != \&Moo::Object::BUILDARGS ) {
'hashrefs also supported'
);
+is(
+ exception { $first->new(one => 1, THREE => 3) },
+ undef,
+ 'calling ->new on an object works'
+);
+
done_testing;