Do you know where your variables are? | |
PerlMonks |
perlfunc:callerby gods (Initiate) |
on Aug 24, 1999 at 22:43 UTC ( [id://359]=perlfunc: print w/replies, xml ) | Need Help?? |
callerSee the current Perl documentation for caller. Here is our local, out-dated (pre-5.6) version: caller - get context of the current subroutine call
caller EXPR caller
Returns the context of the current subroutine call. In scalar context, returns the caller's package name if there is a caller, that is, if we're in a subroutine or eval() or require(), and the undefined value otherwise. In list context, returns
($package, $filename, $line) = caller; With EXPR, it returns some extra information that the debugger uses to print a stack trace. The value of EXPR indicates how many call frames to go back before the current one.
($package, $filename, $line, $subroutine, $hasargs, $wantarray, $evaltext, $is_require) = caller($i);
Here
Furthermore, when called from within the
DB package, caller returns more detailed information:
it sets the list variable
Be aware that the optimizer might have optimized call frames away before
caller() had a chance to get the information. That means that caller(N)
might not return information about the call frame you expect it do, for
|
|