Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

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'

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?

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (14)
As of 2018-10-19 18:00 GMT
Find Nodes?
    Voting Booth?
    When I need money for a bigger acquisition, I usually ...

    Results (110 votes). Check out past polls.