16 sub bound { removed() }
17 delete $main::{removed};
18 is( bound(), 23, 'function still bound' );
19 ok( !main->can('removed'), 'function not available as method' );
22 sub replaced { 'func' }
23 is( replaced(), 'func', 'original function still bound' );
24 is( main->replaced, 'meth', 'method is replaced function' );
25 BEGIN { delete $main::{replaced} }
26 sub replaced { 'meth' }
31 sub bound2 { removed2() }
32 { no strict; undef *{"removed2"} }
34 like( $@, qr/Undefined subroutine &main::removed2 called/,
35 'function not bound' );
36 ok( !main->can('removed2'), 'function not available as method' );
39 sub replaced2 { 'func' }
40 is( replaced2(), 'meth', 'original function not bound, was replaced' );
41 ok( main->replaced2 eq 'meth', 'method is replaced function' );
42 BEGIN { undef $main::{replaced2} }
43 sub replaced2 { 'meth' }