8 eval "use Algorithm::C3";
9 plan skip_all => "Algorithm::C3 required for this test" if $@;
10 plan tests => 4;use Class::MOP;
11 require_ok(File::Spec->catfile('examples', 'C3MethodDispatchOrder.pod'));
16 use metaclass 'C3MethodDispatchOrder';
18 sub hello { 'Diamond_A::hello' }
21 use metaclass 'C3MethodDispatchOrder';
22 __PACKAGE__->meta->superclasses('Diamond_A');
25 use metaclass 'C3MethodDispatchOrder';
26 __PACKAGE__->meta->superclasses('Diamond_A');
28 sub hello { 'Diamond_C::hello' }
31 use metaclass 'C3MethodDispatchOrder';
32 __PACKAGE__->meta->superclasses('Diamond_B', 'Diamond_C');
36 [ Diamond_D->meta->class_precedence_list ],
37 [ qw(Diamond_D Diamond_B Diamond_C Diamond_A) ],
38 '... got the right MRO for Diamond_D');
40 is(Diamond_D->hello, 'Diamond_C::hello', '... got the right dispatch order');
41 is(Diamond_D->can('hello')->(), 'Diamond_C::hello', '... can(method) resolved itself as expected');