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

You might look at $_[0] instead of $self, but that doesn't work if it's been shifted. Maybe it's called $this.

Replies are listed 'Best First'.
Re: Re: Re: Re^3: How can I find the calling object?
by strider corinth (Friar) on Nov 18, 2002 at 19:26 UTC
    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.
      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.