4 use Test::More tests => 4;
10 This tests the classic diamond inheritence pattern.
22 sub hello { 'Diamond_A::hello' }
23 sub foo { 'Diamond_A::foo' }
28 sub foo { 'Diamond_B::foo => ' . (shift)->next::method() }
34 sub hello { 'Diamond_C::hello => ' . (shift)->next::method() }
35 sub foo { 'Diamond_C::foo => ' . (shift)->next::method() }
39 use base ('Diamond_B', 'Diamond_C');
41 sub foo { 'Diamond_D::foo => ' . (shift)->next::method() }
44 is(Diamond_C->hello, 'Diamond_C::hello => Diamond_A::hello', '... method resolved itself as expected');
46 is(Diamond_C->can('hello')->('Diamond_C'),
47 'Diamond_C::hello => Diamond_A::hello',
48 '... can(method) resolved itself as expected');
50 is(UNIVERSAL::can("Diamond_C", 'hello')->('Diamond_C'),
51 'Diamond_C::hello => Diamond_A::hello',
52 '... can(method) resolved itself as expected');
55 'Diamond_D::foo => Diamond_B::foo => Diamond_C::foo => Diamond_A::foo',
56 '... method foo resolved itself as expected');