Keeping in mind that this sounds truly evil, though it does sound a bit like
Damian's
Hook::LexWrap (though I don't think that redefines any subs, just defines new methods with pre and post processing, but you may want to look at that instead/anyway), and you're better off using
dragonchild's suggestions of utilizing ISA and SUPER in an orthodox manner if at all possible:
use strict;
use warnings;
package Bar;
sub f1 {
print "there @_\n";
}
package Foo;
for (keys %Bar::) {
if (exists &{$Bar::{$_}}) {
no warnings 'redefine';
my $func = \&{$Bar::{$_}};
$Bar::{$_} = sub {
print "hello ";
goto &$func;
};
}
}
package main;
Bar::f1("Bob");