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