Commit | Line | Data |
e1a479c5 |
1 | #!/usr/bin/perl |
2 | |
3 | use strict; |
4 | use warnings; |
5f5ae4a7 |
5 | use NEXT; |
e1a479c5 |
6 | |
5f5ae4a7 |
7 | require './test.pl'; |
8 | plan(tests => 4); |
e1a479c5 |
9 | |
10 | { |
11 | package Foo; |
12 | use strict; |
13 | use warnings; |
14 | use mro 'c3'; |
15 | |
16 | sub foo { 'Foo::foo' } |
17 | |
18 | package Fuz; |
19 | use strict; |
20 | use warnings; |
21 | use mro 'c3'; |
22 | use base 'Foo'; |
23 | |
24 | sub foo { 'Fuz::foo => ' . (shift)->next::method } |
25 | |
26 | package Bar; |
27 | use strict; |
28 | use warnings; |
29 | use mro 'c3'; |
30 | use base 'Foo'; |
31 | |
32 | sub foo { 'Bar::foo => ' . (shift)->next::method } |
33 | |
34 | package Baz; |
35 | use strict; |
36 | use warnings; |
e1a479c5 |
37 | |
38 | use base 'Bar', 'Fuz'; |
39 | |
40 | sub foo { 'Baz::foo => ' . (shift)->NEXT::foo } |
41 | } |
42 | |
43 | is(Foo->foo, 'Foo::foo', '... got the right value from Foo->foo'); |
44 | is(Fuz->foo, 'Fuz::foo => Foo::foo', '... got the right value from Fuz->foo'); |
45 | is(Bar->foo, 'Bar::foo => Foo::foo', '... got the right value from Bar->foo'); |
46 | |
47 | is(Baz->foo, 'Baz::foo => Bar::foo => Fuz::foo => Foo::foo', '... got the right value using NEXT in a subclass of a C3 class'); |
48 | |