in reply to A caller() by any other name

What you want is the first argument of the caller, if the caller was called as a method. Without going into the merits of doing so, getting the first argument of the caller appears to be possible (see following output), but I think Perl doesn't track if subroutines were called as methods.
>perl -MCarp -e"sub g { carp } sub f { shift->g } bless({})->f" at -e line 1 main::g('main=HASH(0x235f7c)') called at -e line 1 main::f('main=HASH(0x235f7c)') called at -e line 1

If you don't want to pass the pointer explicitly, you'll need to provide a framework that does it for you.

Perl doesn't do OO. Perl has features that allow people to build OO systems on top of Perl.
- dragonchild, promoting Moose

Replies are listed 'Best First'.
Re^2: A caller() by any other name
by chromatic (Archbishop) on Dec 03, 2008 at 11:49 UTC
    I think Perl doesn't track if subroutines were called as methods.

    You can root around in the optree and get a pretty good idea, but it's complicated and slow and non-deterministic in a couple of edge cases.