11 package Arbitrary::Roll;
15 my $method_meta = Moose::Meta::Class->create_anon_class(
16 superclasses => ['Moose::Meta::Method'],
17 roles => ['Arbitrary::Roll'],
20 # For comparing identity without actually keeping $original_meta around
21 my $original_meta = "$method_meta";
23 my $method_class = $method_meta->name;
25 my $method_object = $method_class->wrap(
27 associated_metaclass => Ball->meta,
28 package_name => 'Ball',
32 Ball->meta->add_method( bounce => $method_object );
35 is( Ball->bounce, 'ok', "method still exists on Ball" );
36 is( Ball->meta->get_method('bounce')->meta->name, $method_class,
37 "method's package still exists" );
39 is( Ball->meta->get_method('bounce'), $method_object,
40 'original method object is preserved' );
42 is( Ball->meta->get_method('bounce')->meta . '', $original_meta,
43 "method's metaclass still exists" );
44 ok( Ball->meta->get_method('bounce')->meta->does_role('Arbitrary::Roll'),
45 "method still does Arbitrary::Roll" );