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)...

(gdb) run -e 'sub foo { caller(0) }; *bar = *foo; my @l=bar()' ... Breakpoint 2, Perl_pp_caller (my_perl=0x804c008) at pp_ctl.c:1567 1567 if (MAXARG) ... (stepping over 'register I32 cxix = dopoptosub(cxstack_ix);') ... (gdb) print ccstack[1].cx_u.cx_blk.blk_u.blku_sub.cv.sv_any.xcv_gv.sv_ +any[0] $7 = {xnv_nv = 0, xpv_cur = 0, xpv_len = 0, xiv_u = {xivu_iv = 0, xivu +_uv = 0, xivu_p1 = 0x0}, xmg_magic = 0x80540ec, xmg_stash = 0x0, xgv_gp = 0 +x80540b4, xgv_name = 0x805410c "foo", xgv_namelen = 3, xgv_stash = 0x804cb4c, xgv_flags = 10 '\n'} (gdb) print ccstack[1].cx_u.cx_blk.blk_u.blku_sub.cv.sv_any.xcv_gv.sv_ +any[1] $8 = {xnv_nv = 0, xpv_cur = 0, xpv_len = 0, xiv_u = {xivu_iv = 0, xivu +_uv = 0, xivu_p1 = 0x0}, xmg_magic = 0x806f244, xmg_stash = 0x0, xgv_gp = 0 +x80540b4, xgv_name = 0x806f264 "bar", xgv_namelen = 3, xgv_stash = 0x804cb4c, xgv_flags = 10 '\n'}

...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}

In reply to Re^10: Beyond Inside-Out (different issue) by shmem
in thread Beyond Inside-Out by Anno

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.