6 use Test::More tests => 4;
12 This tests the classic diamond inheritence pattern.
24 sub hello { 'Diamond_A::hello' }
25 sub foo { 'Diamond_A::foo' }
30 sub foo { 'Diamond_B::foo => ' . (shift)->next::method() }
36 sub hello { 'Diamond_C::hello => ' . (shift)->next::method() }
37 sub foo { 'Diamond_C::foo => ' . (shift)->next::method() }
41 use base ('Diamond_B', 'Diamond_C');
43 sub foo { 'Diamond_D::foo => ' . (shift)->next::method() }
46 is(Diamond_C->hello, 'Diamond_C::hello => Diamond_A::hello', '... method resolved itself as expected');
48 is(Diamond_C->can('hello')->('Diamond_C'),
49 'Diamond_C::hello => Diamond_A::hello',
50 '... can(method) resolved itself as expected');
52 is(UNIVERSAL::can("Diamond_C", 'hello')->('Diamond_C'),
53 'Diamond_C::hello => Diamond_A::hello',
54 '... can(method) resolved itself as expected');
57 'Diamond_D::foo => Diamond_B::foo => Diamond_C::foo => Diamond_A::foo',
58 '... method foo resolved itself as expected');