So you too ended playing with symbol table..:=)
If i understand, and you know i'm still learning, when caller (and i suspect every other trick) starts, the lookup in the symbol table is done and you cannot access anymore the name: you have the right part of the alias assignation.
As i understand you want something like (using the web analogy) to
$ENV{HOST} or
$ENV{REFERRER} to identify the original name or if you had been redirected: I dont think such introspection exists in Perl (i hope i'm wrong).
I think you can only do the opposite thing: given your
show function you can look in the symbol table to collect any enrty that point to the same code.
L*
update: for future reader here the ouput of a playground i working on that shows the alias thing:
CODE PASSED TO EVAL:
package LanX {
$\="\n";
sub show {
print join "\t",(caller(0))[0..3];
};
*func = \&show;
}
PACKAGE: main::LanX:: (2 names defined)
----------------------------------------------------------------------
+-
main::LanX::func
----------------------------------------------------------------------
+-
scalar x
array
hash
code x
io
format
name x
package x
----------------------------------------------------------------------
+-
main::LanX::show
----------------------------------------------------------------------
+-
scalar x
array
hash
code x
io
format
name x
package x
Package Gymnasium>inspect LanX show code
main::LanX::show {CODE} slot
main namespacetest10.pl 100 LanX::show
main namespacetest10.pl 100 LanX::show
1
Package Gymnasium>inspect LanX func code
main::LanX::func {CODE} slot
main namespacetest10.pl 100 LanX::show
main namespacetest10.pl 100 LanX::show
1
There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.