Полезная информация

Programming Perl

Programming PerlSearch this book
Previous: 3.2.9 blessChapter 3
Next: 3.2.11 chdir

3.2.10 caller

caller EXPR

This function returns information about the stack of current subroutine calls. Without an argument it returns the package name, filename, and line number that the currently executing subroutine was called from:

($package, $filename, $line) = caller;

With an argument it evaluates EXPR as the number of stack frames to go back before the current one. It also reports some additional information.

$i = 0;
while (($pack, $file, $line, $subname, $hasargs, $wantarray) = caller($i++)) {

Furthermore, when called from within the DB package, caller returns more detailed information: it sets the list variable @DB::args to be the arguments passed in the given stack frame.

Previous: 3.2.9 blessProgramming PerlNext: 3.2.11 chdir
3.2.9 blessBook Index3.2.11 chdir