[Chicago-talk] Where'd I come from?
Andy_Bach at wiwb.uscourts.gov
Andy_Bach at wiwb.uscourts.gov
Fri Jan 26 09:09:58 PST 2007
Hey,
Somebody was asking me about code like:
eval("require '../support/this.pl' "); # has sub foo
...
eval("foo()");
and how to find, in foo() that it came from this.pl. Using caller I can
get:
package:
filename: (eval 2)
line: 1
subroutine: main::LogIt
hasargs: 1
wantarray:
evaltext:
is_require:
hints: 0
bitmask:
package:
filename: /tmp/call2.pl
line: 2
subroutine: (eval)
hasargs: 0
wantarray:
evaltext: LogIt()
;
is_require:
hints: 0
bitmask:
called from (eval 2)(line: 1) called from /tmp/call2.pl(line: 2)
That is, sub name and main script, but not the 'require'-ed script name.
Is there a way to get that?
a
Andy Bach
Systems Mangler
Internet: andy_bach at wiwb.uscourts.gov
VOICE: (608) 261-5738 FAX 264-5932
Although few may originate a policy, we are all able to judge it.
Pericles of Athens, c.430 B.C.
More information about the Chicago-talk
mailing list