in reply to Re: Defining a function in the caller's package
in thread Defining a function in the caller's package
caller always returns the package where the code was, regardless of which name in which package you used to call the code.
I see, this explains why my first attempt had to fail.
Actually, the reference you gave was very helpful, because what my do_something *really* does, is to call NEXT(). I just left out this detail because I thought it would not be relevant to the problem.
I just wonder whether fiddling around with __ANON__, as shown in the example you refered to, is considered portable Perl style (I couldn't find any "official" Perl documentation about __ANON__), or whether the eval solution I used would be better. Both seem to be a hack, but which one is the kinder hack ?-)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Defining a function in the caller's package
by chromatic (Archbishop) on Aug 08, 2008 at 18:21 UTC |