Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^2: Redefine package subroutines

by tobyink (Abbot)
on Dec 19, 2012 at 14:33 UTC ( #1009570=note: print w/ replies, xml ) Need Help??


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.

perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'


Comment on Re^2: Redefine package subroutines
Select or Download Code
Replies are listed 'Best First'.
Re^3: Redefine package subroutines
by Melly (Hermit) on Dec 19, 2012 at 14:51 UTC

    Ah! - that's it. Many, many thanks...

    map{$a=1-$_/10;map{$d=$a;$e=$b=$_/20-2;map{($d,$e)=(2*$d*$e+$a,$e**2 -$d**2+$b);$c=$d**2+$e**2>4?$d=8:_}1..50;print$c}0..59;print$/}0..20
    Tom Melly, pm (at) cursingmaggot (stop) co (stop) uk

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1009570]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (17)
As of 2015-07-07 19:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (93 votes), past polls