in reply to Re^3: Code asks, in what file do I live?
in thread Code asks, in what file do I live?
Well, if you pass in 0 (caller(0)) then you get the caller information for the current stack frameAnd the current stack frame still shows who called you, not who you are. You can't determine the current filename using caller:
$ cat /tmp/x sub f { my $f = (caller(0))[1]; print "I am: ", __FILE__, "\n"; print "caller: $f\n"; } 1; $ perl585 -e 'require "/tmp/x"; f()' I am: /tmp/x caller: -e $
Dave.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
| A reply falls below the community's threshold of quality. You may see it by logging in. |