1use Test::More tests => 7; 2 3BEGIN { use_ok('NEXT') }; 4 5package A; 6use base qw(B); 7use NEXT; 8sub test_next { shift->NEXT::test_next(@_); } 9sub test_next_distinct { shift->NEXT::DISTINCT::test_next_distinct(@_); } 10sub test_next_actual { shift->NEXT::ACTUAL::test_next_actual(@_); } 11sub test_next_actual_distinct { shift->NEXT::ACTUAL::DISTINCT::test_next_actual_distinct(@_); } 12sub test_every { shift->EVERY::test_every(@_); } 13sub test_every_last { shift->EVERY::LAST::test_every_last(@_); } 14 15package B; 16sub test_next { $_[1]; } 17sub test_next_distinct { $_[1]; } 18sub test_next_actual { $_[1]; } 19sub test_next_actual_distinct { $_[1]; } 20sub test_every { $_[1]; } 21sub test_every_last { $_[1]; } 22 23package main; 24 25my $foo = bless {}, 'A'; 26 27"42" =~ /(.*)/; 28is($foo->test_next($&), $&, "The value of '\$&' was not overwritten in NEXT."); 29 30"42" =~ /(.*)/; 31is($foo->test_next_distinct($&), $&, "The value of '\$&' was not overwritten in NEXT::DISTINCT."); 32 33"42" =~ /(.*)/; 34is($foo->test_next_actual($&), $&, "The value of '\$&' was not overwritten in NEXT::ACTUAL."); 35 36"42" =~ /(.*)/; 37is($foo->test_next_actual_distinct($&), $&, "The value of '\$&' was not overwritten in NEXT::ACTUAL::DISTINCT."); 38 39"42" =~ /(.*)/; 40is($foo->test_every($&)->{'B::test_every'}, $&, "The value of '\$&' was not overwritten in EVERY."); 41 42"42" =~ /(.*)/; 43is($foo->test_every_last($&)->{'B::test_every_last'}, $&, "The value of '\$&' was not overwritten in EVERY::LAST."); 44