Help for this page

Select Code to Download


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