in reply to Re: Re: Re^3: How can I find the calling object?
in thread How can I find the calling object?

Tried it. @_ isn't a lexical variable, at least as far as PadWalker's concerned. Only if you actually assign a value from @_ to some other variable does it become available. Good idea, though. =)
--
Love justice; desire mercy.
  • Comment on Re: Re: Re: Re^3: How can I find the calling object?

Replies are listed 'Best First'.
Re: Re: Re: Re: Re^3: How can I find the calling object?
by John M. Dlugosz (Monsignor) on Nov 18, 2002 at 20:42 UTC
    Perhaps the caller DB trick is best, then, since it is reported to give the "original" parameters to the function. Then it doesn't matter what the function named it locally, or shifted it off or not.
      The only problem is that in my particular case, I wanted to do this with a Tk::Listbox-derived class I wrote. Since it has to be a Tk module, the DB trick wouldn't work. You're probably right for all other situations, though.
      --
      Love justice; desire mercy.
        Why not? The function implemented in DB:: can be written anywhere in the source. Your called function calls it to get the enhanced caller() info. You don't have to put your called function itself into a funny package.