#!perl use strict; use warnings; package Foo::Bar; sub frobnitz { print "frobnitz in " . __PACKAGE__ . "\n"; }; package Foo::Whatever; use strict; use warnings; require Object::Import; sub frobnitz { print "frobnitz in " . __PACKAGE__ ."\n"; }; frobnitz(); { local *Foo::Whatever::frobnitz; my $object = {}; bless $object => "Foo::Bar"; Object::Import->import( $object, list => ['frobnitz'], nowarn_redefine => 1 ); # Make all methods of $object available as functions frobnitz(); # call $object->frobnitz(); } frobnitz(); __END__ frobnitz in Foo::Whatever frobnitz in Foo::Bar frobnitz in Foo::Whatever