1*eac174f2Safresh1use strict; 2*eac174f2Safresh1use warnings; 3b39c5158Smillertuse Test::More tests => 10; 4b39c5158Smillert 5b39c5158SmillertBEGIN { use_ok('NEXT') }; 6b39c5158Smillertmy $order = 0; 7b39c5158Smillert 8b39c5158Smillertpackage A; 9*eac174f2Safresh1our @ISA = qw/B C D/; 10*eac174f2Safresh1use if $] >= 5.009005, 'mro', 'dfs'; 11*eac174f2Safresh1 12b39c5158Smillert 13b39c5158Smillertsub test { ++$order; ::ok($order==1,"test A"); $_[0]->NEXT::ACTUAL::test;} 14b39c5158Smillert 15b39c5158Smillertpackage B; 16*eac174f2Safresh1our @ISA = qw/D C/; 17*eac174f2Safresh1use if $] >= 5.009005, 'mro', 'dfs'; 18b39c5158Smillertsub test { ++$order; ::ok($order==2,"test B"); $_[0]->NEXT::ACTUAL::test;} 19b39c5158Smillert 20b39c5158Smillertpackage C; 21*eac174f2Safresh1our @ISA = qw/D/; 22*eac174f2Safresh1use if $] >= 5.009005, 'mro', 'dfs'; 23*eac174f2Safresh1 24b39c5158Smillertsub test { 25b39c5158Smillert ++$order; ::ok($order==4||$order==6,"test C"); 26b39c5158Smillert $_[0]->NEXT::ACTUAL::test; 27b39c5158Smillert} 28b39c5158Smillert 29b39c5158Smillertpackage D; 30*eac174f2Safresh1use if $] >= 5.009005, 'mro', 'dfs'; 31b39c5158Smillert 32b39c5158Smillertsub test { 33b39c5158Smillert ++$order; ::ok($order==3||$order==5||$order==7||$order==8,"test D"); 34b39c5158Smillert $_[0]->NEXT::ACTUAL::test; 35b39c5158Smillert} 36b39c5158Smillert 37b39c5158Smillertpackage main; 38*eac174f2Safresh1use if $] >= 5.009005, 'mro', 'dfs'; 39b39c5158Smillert 40b39c5158Smillertmy $foo = {}; 41b39c5158Smillert 42b39c5158Smillertbless($foo,"A"); 43b39c5158Smillert 44b39c5158Smillerteval{ $foo->test } 45b39c5158Smillert ? fail("Didn't die on missing ancestor") 46b39c5158Smillert : pass("Correctly dies after full traversal"); 47