X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pod%2Fperldebug.pod;h=7d8d84f3edad8c2e4fcf1fea8ad2c659eb882fb3;hb=b4793f7f58b137d8b2f6d505d6c77dee2cd8cb25;hp=25abfd6b3c4d7cfa9dc9fc1e168fe87cc065a165;hpb=54310121b442974721115f93666234a200f5c7e4;p=p5sagit%2Fp5-mst-13.2.git diff --git a/pod/perldebug.pod b/pod/perldebug.pod index 25abfd6..7d8d84f 100644 --- a/pod/perldebug.pod +++ b/pod/perldebug.pod @@ -8,6 +8,14 @@ First of all, have you tried using the B<-w> switch? =head1 The Perl Debugger +"As soon as we started programming, we found to our +surprise that it wasn't as easy to get programs right +as we had thought. Debugging had to be discovered. +I can remember the exact instant when I realized that +a large part of my life from then on was going to be +spent in finding mistakes in my own programs." +--Maurice Wilkes, 1949 + If you invoke Perl with the B<-d> switch, your script runs under the Perl source debugger. This works like an interactive Perl environment, prompting for debugger commands that let you examine @@ -332,6 +340,10 @@ If 0, allows I the end of the script. affects printing of return value after C command. +=item C + +affects screen appearance of the command line (see L). + =item C affects printing messages on entry and exit from subroutines. If @@ -340,8 +352,11 @@ on exit may be useful if inter(di)spersed with other messages.) If C, arguments to functions are printed as well as the context and caller info. If C, overloaded C and -Cd C are enabled on the printed arguments. The length at -which the argument list is truncated is governed by the next option: +Cd C are enabled on the printed arguments. If C, the return value from the subroutine is printed as well. + +The length at which the argument list is truncated is governed by the +next option: =item C @@ -468,37 +483,37 @@ See L<"Debugger Internals"> below for more details. =item E [ command ] Set an action (Perl command) to happen before every debugger prompt. -A multiline command may be entered by backslashing the newlines. If +A multi-line command may be entered by backslashing the newlines. If C is missing, resets the list of actions. =item EE command Add an action (Perl command) to happen before every debugger prompt. -A multiline command may be entered by backslashing the newlines. +A multi-line command may be entered by backslashing the newlines. =item E command Set an action (Perl command) to happen after the prompt when you've -just given a command to return to executing the script. A multiline +just given a command to return to executing the script. A multi-line command may be entered by backslashing the newlines. If C is missing, resets the list of actions. =item EE command Adds an action (Perl command) to happen after the prompt when you've -just given a command to return to executing the script. A multiline +just given a command to return to executing the script. A multi-line command may be entered by backslashing the newlines. =item { [ command ] Set an action (debugger command) to happen before every debugger prompt. -A multiline command may be entered by backslashing the newlines. If +A multi-line command may be entered by backslashing the newlines. If C is missing, resets the list of actions. =item {{ command Add an action (debugger command) to happen before every debugger prompt. -A multiline command may be entered by backslashing the newlines. +A multi-line command may be entered by backslashing the newlines. =item ! number @@ -602,7 +617,7 @@ expression via C command. =item Multiline commands -If you want to enter a multiline command, such as a subroutine +If you want to enter a multi-line command, such as a subroutine definition with several statements, or a format, you may escape the newline that would normally end the debugger command with a backslash. Here's an example: @@ -669,7 +684,9 @@ optionally exited) subroutines in different styles. What follows is the start of the listing of - env "PERLDB_OPTS=f=1 N" perl -d -V + env "PERLDB_OPTS=f=n N" perl -d -V + +for different values of C: =over 4 @@ -774,13 +791,33 @@ What follows is the start of the listing of in $=Config::FETCH('Config=HASH(0x1aa444)', 'baserev') from lib/Config.pm:574 out $=Config::FETCH('Config=HASH(0x1aa444)', 'baserev') from lib/Config.pm:574 +=item 30 + + in $=CODE(0x15eca4)() from /dev/null:0 + in $=CODE(0x182528)() from lib/Config.pm:2 + Package lib/Exporter.pm. + out $=CODE(0x182528)() from lib/Config.pm:0 + scalar context return from CODE(0x182528): undef + Package lib/Config.pm. + in $=Config::TIEHASH('Config') from lib/Config.pm:628 + out $=Config::TIEHASH('Config') from lib/Config.pm:628 + scalar context return from Config::TIEHASH: empty hash + in $=Exporter::import('Config', 'myconfig', 'config_vars') from /dev/null:0 + in $=Exporter::export('Config', 'main', 'myconfig', 'config_vars') from lib/Exporter.pm:171 + out $=Exporter::export('Config', 'main', 'myconfig', 'config_vars') from lib/Exporter.pm:171 + scalar context return from Exporter::export: '' + out $=Exporter::import('Config', 'myconfig', 'config_vars') from /dev/null:0 + scalar context return from Exporter::import: '' + + =back In all the cases indentation of lines shows the call tree, if bit 2 of C is set, then a line is printed on exit from a subroutine as well, if bit 4 is set, then the arguments are printed as well as the caller info, if bit 8 is set, the arguments are printed even if they -are tied or references. +are tied or references, if bit 16 is set, the return value is printed +as well. When a package is compiled, a line like this