1#!/usr/bin/perl 2 3use strict; 4use warnings; 5 6require q(./test.pl); plan(tests => 4); 7 8use mro; 9 10{ 11 package Proxy; 12 our @ISA = qw//; 13 sub next_proxy { goto &next::method } 14 sub maybe_proxy { goto &maybe::next::method } 15 sub can_proxy { goto &next::can } 16 17 package TBase; 18 our @ISA = qw//; 19 sub foo { 42 } 20 sub bar { 24 } 21 # baz doesn't exist intentionally 22 sub quux { 242 } 23 24 package TTop; 25 our @ISA = qw/TBase/; 26 sub foo { shift->Proxy::next_proxy() } 27 sub bar { shift->Proxy::maybe_proxy() } 28 sub baz { shift->Proxy::maybe_proxy() } 29 sub quux { shift->Proxy::can_proxy()->() } 30} 31 32is(TTop->foo, 42, 'proxy next::method via goto'); 33is(TTop->bar, 24, 'proxy maybe::next::method via goto'); 34ok(!TTop->baz, 'proxy maybe::next::method via goto with no method'); 35is(TTop->quux, 242, 'proxy next::can via goto'); 36