1#!./perl 2 3BEGIN { 4 unless (-d 'blib') { 5 chdir 't' if -d 't'; 6 } 7 require q(./test.pl); 8 set_up_inc('../lib'); 9} 10 11use strict; 12use warnings; 13 14plan(tests => 1); 15 16require mro; 17 18=pod 19 20This example is take from: http://www.python.org/2.3/mro.html 21 22"Serious order disagreement" # From Guido 23class O: pass 24class X(O): pass 25class Y(O): pass 26class A(X,Y): pass 27class B(Y,X): pass 28try: 29 class Z(A,B): pass #creates Z(A,B) in Python 2.2 30except TypeError: 31 pass # Z(A,B) cannot be created in Python 2.3 32 33=cut 34 35{ 36 package X; 37 38 package Y; 39 40 package XY; 41 our @ISA = ('X', 'Y'); 42 43 package YX; 44 our @ISA = ('Y', 'X'); 45 46 package Z; 47 our @ISA = ('XY', 'YX'); 48} 49 50eval { mro::get_linear_isa('Z', 'c3') }; 51like($@, qr/^Inconsistent hierarchy during C3 merge of class 'Z'/, 52 '... got the right error with an inconsistent hierarchy'); 53