in reply to Re^8: Beyond Inside-Out (did I get it?)
in thread Beyond Inside-Out

how could that be different from what $class is in ($class = (caller(0)­)[3] ) =~ s/::[^:]+$­// ?

Quoting myself:

The correct thing to look up is not [...] nor the package part of the orignal name given to the subroutine (the two things that caller can give you).

and

*My::Modul­e::foo= \&Handy::G­etOrSet;

So "Handy::GetOrSet" is the original name that uses a package name that has nothing to do with the class name of "My::Module".

- tye        

Replies are listed 'Best First'.
Re^10: Beyond Inside-Out (different issue)
by shmem (Chancellor) on May 31, 2007 at 11:06 UTC
    Well, Anno's technique doesn't claim to address that, let alone solve it.

    AFAIK caller looks up subroutine names via the coderef of the stack frame in question. While many entries in the symbol table may point to the same typeglob, the xgv_name field of that typeglob's coderef entry ever only holds one name, which is returned by caller.

    <update>

    Erm, no. Poking around with gdb (Perl_pp_caller, file pp_ctl.c)...

    ...the glob alias 'bar' is available via ccstack = (const PERL_CONTEXT *), now I have to find out how to resolve the right sv_any to get at the correct xgv_name field. Yes, but how? :-)

    </update>

    --shmem

    _($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                                  /\_¯/(q    /
    ----------------------------  \__(m.====·.(_("always off the crowd"))."·
    ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}