10 eval "use Algorithm::C3";
11 plan skip_all => "Algorithm::C3 required for this test" if $@;
15 require_ok(File::Spec->catdir('examples', 'C3MethodDispatchOrder.pod'));
20 use metaclass 'C3MethodDispatchOrder';
22 sub hello { 'Diamond_A::hello' }
25 use metaclass 'C3MethodDispatchOrder';
26 __PACKAGE__->meta->superclasses('Diamond_A');
29 use metaclass 'C3MethodDispatchOrder';
30 __PACKAGE__->meta->superclasses('Diamond_A');
32 sub hello { 'Diamond_C::hello' }
35 use metaclass 'C3MethodDispatchOrder';
36 __PACKAGE__->meta->superclasses('Diamond_B', 'Diamond_C');
40 [ Diamond_D->meta->class_precedence_list ],
41 [ qw(Diamond_D Diamond_B Diamond_C Diamond_A) ],
42 '... got the right MRO for Diamond_D');
44 is(Diamond_D->hello, 'Diamond_C::hello', '... got the right dispatch order');
45 is(Diamond_D->can('hello')->(), 'Diamond_C::hello', '... can(method) resolved itself as expected');