Exported subroutine redefineby ribasushi (Monk)
|on Nov 10, 2007 at 11:41 UTC||Need Help??|
ribasushi has asked for the
wisdom of the Perl Monks concerning the following question:
Hello fellow monks,
I have a situation in which I have a 3rd party module which exports some subroutines which I need to redefine (lets not delve into a discussion of why this is bad, etc.). Here is an example:
Now unless 'use redefine' preceeds _any_ 'use module' - everything works as expected. However if I do this:
I still get 'old', because the symbol table is still referencing the first version of function().
Is there a way to truly redefine a subroutine, or the only way to do this right is to ensure redefine.pm is the very first one use()d in any circumstances?