Perl Debugger Pocket Reference

Errata for Perl Debugger Pocket Reference

Submit your own errata for this product.


The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.

Color Key: Serious Technical Mistake Minor Technical Mistake Language or formatting error Typo Question Note Update



Version Location Description Submitted By Date Submitted Date Corrected
Printed
Page 4
URL in the middle of the page

http://www.oreilly.com/the-perl-debugger/code NOW READS: http://examples.oreilly.com/9780596528935

Anonymous    Aug 01, 2004
Printed
Page 4
URL in the middle of the page

http://www.oreilly.com/the-perl-debugger/code NOW READS: http://examples.oreilly.com/9780596528935

Anonymous    Aug 01, 2004
Printed
Page 27
Example at end of "p" section

$bar = bless({foo=$foo}, 'Foo')> ^ ^ NOW READS: $bar = bless({'foo' => $foo}, 'Foo')

Anonymous    Aug 01, 2004
Printed
Page 27
Example at end of "p" section

$bar = bless({foo=$foo}, 'Foo')> ^ ^ NOW READS: $bar = bless({'foo' => $foo}, 'Foo')

Anonymous    Aug 01, 2004
Printed
Page 32
Example near bottom page for 'x'

$bar = {foo=$foo,depth2=>{depth3=>'here'}} ^ ^ NOW READS: $bar = {'foo' => $foo,depth2=>{depth3=>'here'}}

Anonymous    Aug 01, 2004
Printed
Page 32
Example near bottom page for 'x'

$bar = {foo=$foo,depth2=>{depth3=>'here'}} ^ ^ NOW READS: $bar = {'foo' => $foo,depth2=>{depth3=>'here'}}

Anonymous    Aug 01, 2004
Printed
Page 76
- 2 missing sections (= and R)!

These 2 commands are missing their (correct) index entries too! Insert the following chunk between the commands and the option sections: R Re-run the current debug session. R usage R R (current session) The R command quits the current session and restarts a new one, using as much information as it can remember from the previous session. Certain information is lost, though all command line arguments, debugger options, and environment variables are retained across the restart, as are command history, breakpoints, and actions. You might want to do this when you wish to continue debugging the current program, but wish to start from from the beginning again, for example to set a break point on a subroutine or module which has already been loaded. To demonstrate the command history and command line arguments, we can use the -- switch to tell Perl that the following arguments are to be passed as the command line to the program: perldb@monkey> B<perl -d -e 0 -- cmd-line arguments> <...truncated output...> main::(-e:1): 0 DB<1> Now dump the command line arguments for reference: C<> DB<1> x @ARGV 0 ARRAY(0x8148dbc) 0 'cmd-line' 1 'arguments' DB<2> Use shift to remove the left-most element and dump the arguments again to ensure we have just the one element remaining: DB<2> shift @ARGV DB<3> <x @ARGV> x @ARGV 0 ARRAY(0x8148dbc) 0 'arguments' DB<3> Now restart the debugger session: C<> DB<4> R Warning: some settings and command-line options may be lost! <...truncated output...> main::(-e:1): 0 DB<4> Check the command line arguments again to ensure that we have the original once more and reuse the first command, noting the command numbers remain from the restarted session/s: DB<4> !1 x @ARGV 0 ARRAY(0x81483c8) 0 'cmd-line' 1 'arguments' DB<5> ----- = Alias a word to a debugger command. = usage = [alias value] = alias value Whenever the string alias is seen, it will be replaced with the specified value. To print your favorite variable, or to map S (for subroutine) to F (for function) (my preference): perldb@monkey> perl -d -e 0 <...truncated output...> DB<1> = xo print "os: $^O" xo = print "os: $^O" DB<2> = F S F = S DB<3> xo os: linux DB<4> = alias Display the value of the given alias C<> DB<4> = xo xo = "print $^O" DB<5> = When no arguments are given, list all aliases C<> DB<5> = F = S xo = "print $^O" DB<5> An interesting use of an alias is one picked up from perlmonks (see http://perlmonks.org/) to set a breakpoint on any warning. Place the following code into a file warn.pl. warn ("warning here"); print("warned but not dead yet "); die ("dieing here"); Call it with the debugger and use c to run directly to the end of the program. perldb@monkey> perl -d warn.pl <...truncated output...> main::(warn.pl:2): warn ("warning here"); DB<1> c warning here at warn.pl line 2. warned but not dead yet dieing here at warn.pl line 4. Debugged program terminated. Use q to quit or R to restart, use O inhibit_exit to avoid stopping after program termination, h q, h R or h O to get additional info. DB<1> There was a warning() and a print statement followed by the program dieing at line 4. Place the following code into the rc .perldb file. sub afterinit { push(@DB::typeahead, '= bow $SIG{__WARN__} = sub {$DB::single=2;}'); } Then use R to restart the same session. C<> DB<1> R Warning: some settings and command-line options may be lost! Loading DB routines from perl5db.pl version 1.19 Editor support available. Enter h or `h h' for help, or `man perldebug' for more help. main::(warn.pl:2): warn ("warning here"); auto(-1) DB<0> = bow $SIG{__WARN__} = sub {$DB::single=2;} bow = $SIG{__WARN__} = sub {$DB::single=2;} DB<1> Now the alias is set define a warn handler any time you need one. Simply type B<bow> to install it, followed by c to see how far the program gets this time. C<> DB<1> bow DB<2> c main::(warn.pl:3): print("warned but not dead yet "); DB<2> Very handy. You should be careful not to reuse any existing command mappings when creating aliases, or you're liable to end up with some strange behaviour or even unusable commands. For example, if you alias the C<l> to something else, you won't be able to list your source code until you exit the current session and restart the debugger.

Anonymous   
Printed
Page 76
- 2 missing sections (= and R)!

These 2 commands are missing their (correct) index entries too! Insert the following chunk between the commands and the option sections: R Re-run the current debug session. R usage R R (current session) The R command quits the current session and restarts a new one, using as much information as it can remember from the previous session. Certain information is lost, though all command line arguments, debugger options, and environment variables are retained across the restart, as are command history, breakpoints, and actions. You might want to do this when you wish to continue debugging the current program, but wish to start from from the beginning again, for example to set a break point on a subroutine or module which has already been loaded. To demonstrate the command history and command line arguments, we can use the -- switch to tell Perl that the following arguments are to be passed as the command line to the program: perldb@monkey> B<perl -d -e 0 -- cmd-line arguments> <...truncated output...> main::(-e:1): 0 DB<1> Now dump the command line arguments for reference: C<> DB<1> x @ARGV 0 ARRAY(0x8148dbc) 0 'cmd-line' 1 'arguments' DB<2> Use shift to remove the left-most element and dump the arguments again to ensure we have just the one element remaining: DB<2> shift @ARGV DB<3> <x @ARGV> x @ARGV 0 ARRAY(0x8148dbc) 0 'arguments' DB<3> Now restart the debugger session: C<> DB<4> R Warning: some settings and command-line options may be lost! <...truncated output...> main::(-e:1): 0 DB<4> Check the command line arguments again to ensure that we have the original once more and reuse the first command, noting the command numbers remain from the restarted session/s: DB<4> !1 x @ARGV 0 ARRAY(0x81483c8) 0 'cmd-line' 1 'arguments' DB<5> ----- = Alias a word to a debugger command. = usage = [alias value] = alias value Whenever the string alias is seen, it will be replaced with the specified value. To print your favorite variable, or to map S (for subroutine) to F (for function) (my preference): perldb@monkey> perl -d -e 0 <...truncated output...> DB<1> = xo print "os: $^O" xo = print "os: $^O" DB<2> = F S F = S DB<3> xo os: linux DB<4> = alias Display the value of the given alias C<> DB<4> = xo xo = "print $^O" DB<5> = When no arguments are given, list all aliases C<> DB<5> = F = S xo = "print $^O" DB<5> An interesting use of an alias is one picked up from perlmonks (see http://perlmonks.org/) to set a breakpoint on any warning. Place the following code into a file warn.pl. warn ("warning here"); print("warned but not dead yet "); die ("dieing here"); Call it with the debugger and use c to run directly to the end of the program. perldb@monkey> perl -d warn.pl <...truncated output...> main::(warn.pl:2): warn ("warning here"); DB<1> c warning here at warn.pl line 2. warned but not dead yet dieing here at warn.pl line 4. Debugged program terminated. Use q to quit or R to restart, use O inhibit_exit to avoid stopping after program termination, h q, h R or h O to get additional info. DB<1> There was a warning() and a print statement followed by the program dieing at line 4. Place the following code into the rc .perldb file. sub afterinit { push(@DB::typeahead, '= bow $SIG{__WARN__} = sub {$DB::single=2;}'); } Then use R to restart the same session. C<> DB<1> R Warning: some settings and command-line options may be lost! Loading DB routines from perl5db.pl version 1.19 Editor support available. Enter h or `h h' for help, or `man perldebug' for more help. main::(warn.pl:2): warn ("warning here"); auto(-1) DB<0> = bow $SIG{__WARN__} = sub {$DB::single=2;} bow = $SIG{__WARN__} = sub {$DB::single=2;} DB<1> Now the alias is set define a warn handler any time you need one. Simply type B<bow> to install it, followed by c to see how far the program gets this time. C<> DB<1> bow DB<2> c main::(warn.pl:3): print("warned but not dead yet "); DB<2> Very handy. You should be careful not to reuse any existing command mappings when creating aliases, or you're liable to end up with some strange behaviour or even unusable commands. For example, if you alias the C<l> to something else, you won't be able to list your source code until you exit the current session and restart the debugger.

Anonymous   
Printed
Page 90
1st paragraph, the first line

DB<3> o arraydepth=2 NOW READS: DB<3> o arrayDepth=2

Anonymous    Aug 01, 2004
Printed
Page 90
Last code segment, the first debugger command

DB<1> %hash = ('this = 'that', 'and' => 'so on') NOW READS: DB<1> %hash = ('this' => 'that', 'and' => 'so on')

Anonymous    Aug 01, 2004
Printed
Page 90
1st paragraph, the first line

DB<3> o arraydepth=2 NOW READS: DB<3> o arrayDepth=2

Anonymous    Aug 01, 2004
Printed
Page 90
Last code segment, the first debugger command

DB<1> %hash = ('this = 'that', 'and' => 'so on') NOW READS: DB<1> %hash = ('this' => 'that', 'and' => 'so on')

Anonymous    Aug 01, 2004
Printed
Page 126
Pre-Post Prompt Commands section

Pre-debugger < ... NOW READS: Pre-Pperl < ... AND Post-debugger > NOW READS: Post-perl > ... AND Per-perl { ... NOW READS: Per-debugger

Anonymous    Aug 01, 2004
Printed
Page 126
Pre-Post Prompt Commands section

Pre-debugger < ... NOW READS: Pre-Pperl < ... AND Post-debugger > NOW READS: Post-perl > ... AND Per-perl { ... NOW READS: Per-debugger

Anonymous    Aug 01, 2004