in reply to Re: Redefine package subroutines
in thread Redefine package subroutines
"One mystery - there is a commented out call to delete_FP at line 24. If I don't comment this out, I get an error when I get to "print FP::subtest1()" on line 30, although the subsequent call to delete_FP seems to work fine - any ideas?"
Use FP->subtest1(), not FP::subtest1(). It's all about when the sub name is resolved to its implementation. Colons at compile-time; arrows at run-time. So FP::subtest1() gets bound at compile time to your original subtest1 function, but that gets destroyed when you delete the FP package. Even though you load a new subtest1 implementation, lines 30 and 40 are still bound to the original version of the function which has since disappeared.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Redefine package subroutines
by Melly (Chaplain) on Dec 19, 2012 at 14:51 UTC |