Mouse::Object->new if the invoking class is not the one it was
contructed for, as Moose's implementation does. Test case included.
sub generate_constructor_method_inline {
my ($class, $meta) = @_;
+ my $associated_metaclass_name = $meta->name;
my @attrs = $meta->compute_all_applicable_attributes;
my $buildall = $class->_generate_BUILDALL($meta);
my $buildargs = $class->_generate_BUILDARGS($meta);
my $code = <<"...";
sub {
my \$class = shift;
+ return \$class->Mouse::Object::new(\@_)
+ if \$class ne '$associated_metaclass_name';
$buildargs;
my \$instance = bless {}, \$class;
$processattrs;
}
ok(Role::Reality->meta->has_method('twist'), '... the twist method has not been added');
-#ok(!Role::Reality->meta->does_role('Role::Plot'), '... our role does() the correct roles');
+ok(!Role::Reality->meta->does_role('Role::Plot'), '... our role does() the correct roles');
is(Role::Reality->meta->get_method('twist')->(),
'Role::Reality::twist',
'... the twist method returns the right value');