in reply to Trapping a Function Call in Non-OO Perl
Take a look at Hook::LexWrap
You don't need to worry too much about the scary internals of this module to use it