Help for this page
{ no warnings 'redefine'; *foo = \&Interface1::foo; } print foo(); { no warnings 'redefine'; *foo = \&Interface2::foo; } print foo();
sub use_from { no strict 'refs'; ... my $package = shift; *{ $_ } = *{ "$package\::$_" }{CODE} for @_; }
use_from('Interface1', 'foo', 'bar'); foo(); bar() use_from('Interface2', 'foo', 'bar') foo(); bar();