12 use Test::More tests => 10;
16 This example is take from: http://www.python.org/2.3/mro.html
30 Level 3 | O | (more general)
36 Level 2 3 | D | 4| E | | F | 5 |
42 Level 1 1 | B | | C | 2 |
47 Level 0 0 | A | (more specialized)
64 sub C_or_E { 'Test::E' }
70 sub C_or_D { 'Test::D' }
73 use base ('Test::D', 'Test::F');
76 sub C_or_D { 'Test::C' }
77 sub C_or_E { 'Test::C' }
81 use base ('Test::D', 'Test::E');
84 use base ('Test::B', 'Test::C');
89 mro::get_linear_isa('Test::F'),
90 [ qw(Test::F Test::O) ],
91 '... got the right MRO for Test::F');
94 mro::get_linear_isa('Test::E'),
95 [ qw(Test::E Test::O) ],
96 '... got the right MRO for Test::E');
99 mro::get_linear_isa('Test::D'),
100 [ qw(Test::D Test::O) ],
101 '... got the right MRO for Test::D');
104 mro::get_linear_isa('Test::C'),
105 [ qw(Test::C Test::D Test::F Test::O) ],
106 '... got the right MRO for Test::C');
109 mro::get_linear_isa('Test::B'),
110 [ qw(Test::B Test::D Test::E Test::O) ],
111 '... got the right MRO for Test::B');
114 mro::get_linear_isa('Test::A'),
115 [ qw(Test::A Test::B Test::C Test::D Test::E Test::F Test::O) ],
116 '... got the right MRO for Test::A');
118 is(Test::A->C_or_D, 'Test::C', '... got the expected method output');
119 is(Test::A->can('C_or_D')->(), 'Test::C', '... can got the expected method output');
120 is(Test::A->C_or_E, 'Test::C', '... got the expected method output');
121 is(Test::A->can('C_or_E')->(), 'Test::C', '... can got the expected method output');