Debugger Support
Perl provides special debugging hooks at both compile
time and run time for creating debugging environments such as the
standard debugger. These hooks are not to be confused with the
perl -D options, which are usable only if your
Perl was built with -DDEBUGGING support.
For example, whenever you call Perl's built-in
caller function from the package
DB, the arguments that the corresponding stack
frame was called with are copied to the the
@DB::args array. When you invoke Perl with the
-d switch, the following additional features
are enabled:
Perl inserts the contents of
$ENV{PERL5DB}(orBEGIN {require 'perl5db.pl'}if not present) before the first line of your program.The array
@{"_<$filename"}holds the lines of$filenamefor all files compiled by Perl. The same forevaled strings that contain subroutines or are currently being executed. The$filenameforevaled strings looks like(eval 34). Code assertions in regular expressions look like(re_eval 19).The hash
%{"_<$filename"}contains breakpoints and actions keyed by line number. You can set individual entries as opposed to the whole hash. Perl only cares about Boolean truth here, although the values used by perl5db.pl have the form "$break_condition\0$action". Values in this hash are magical in numeric context: they are zeros if the line is not breakable.The same holds for evaluated strings that contain subroutines or are currently being executed. The
$filenameforevaled strings looks like(eval 34)or(re_eval ...