The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

backtrace(skip[,count,scan_for_DB])

Collect the traceback information available via caller(). Some filtering and cleanup of the data is done.

skip defines the number of stack frames to be skipped, working backwards from the most current frame before the call the debugger DB::DB call if scan_for_DB is set, or the most-current frame.

count determines the total number of call frames to be returned; all of them (well, the first 10^9) are returned if count is omitted.

This routine returns a list of hashes, from most-recent to least-recent stack frame. Each has the following keys and values:

  • wantarray - . (null), $ (scalar), or @ (array)

  • fn - subroutine name, or eval information

  • args - undef, or a reference to an array of arguments

  • file - the file in which this item was defined (if any)

  • line - the line on which it was defined

  • evaltext - eval text if we are in an eval.