Perl Cookbook, 2nd Edition by Tom Christiansen, Nathan Torkington This errata page lists errors corrected in the most recent printing. If you have technical questions or error reports, you can send them to booktech@oreilly.com. Please specify the printing date of your copy. This page was updated August 20, 2007. Here's a key to the markup: [page-number]: serious technical mistake {page-number}: minor technical mistake : important language/formatting problem (page-number): language change or minor formatting problem ?page-number?: reader question or request for clarification [195] last paragraph; "The /m modifier allows ^ and $ to match immediately before and after an embedded newline, respectively." It ought to read "after and before". The example in the next line correctly states "/^=head[1-7]/m would match ... right after a newline ..." {265} Paragraph 2 in the Solution of recipe 7.11, "Creating Temporary Files" says: use File::Temp qw/ tempdir /; $fh = tempfile(); # just the handle change this to use File::Temp qw(tempfile); $fh = tempfile(); # just the handle We're telling people to use "tempfile" but we're importing "tempdir". The change lets us import "tempfile". the second block of code in the Solution has similar problems. Change use File::Temp qw/ tempdir /; # or specify a directory $dir = tempdir( CLEANUP => 1 ); ($fh, $filename) = tempfile( DIR => $dir ); to: use File::Temp qw(tempdir); $dir = tempdir( CLEANUP => 1 ); # or specify a directory use File::Temp qw(tempfile); ($fh, $filename) = tempfile( DIR => $dir ); (330) comment in code block near middle of page; Change: # the real uid is in stored in to: # the real uid is stored in (372) last line; The empty lines before the last line: } should be removed. (419) Near mid-page, line below "Print &$counter1 ..."; the stated output should have a line with a 0 first. The old was: print &$counter1, " ", &$counter2, "\n"; 1 2 3 4 5 0 and should read instead print &$counter1, " ", &$counter2, "\n"; 0 1 2 3 4 5 0 (447) Paragraph beginning "Line 4 assigns..."; "Cards::Poke::shuffle" should be "Cards::Poker::shuffle" (450) Paragraph above "@EXPORT_OK"; To load the module at compile time but request that no symbols be exported, use the special form C, with empty parentheses. And it should read: To load the module at compile time but request that no symbols be exported, use the special form C, supplying empty parentheses for the import list. (495) modname subroutine (line 68); if (index($_, $Start_Dir . "/") = = 0) { This generates an error at compile time. Should be modified to read: if (index($_, $Start_Dir . "/") == 0) { (489) Second from last line on page; Line % tar xf Some-Module-4.54 should read % tar xf Some-Module-4.54.tar (522) Second line of code under title Solution; Line $obj->$methname(10); # invokes $ob->flicker(10); should read $obj->$methname(10); # invokes $obj->flicker(10); Many examples use '$obj' as the example object reference variable. This page uses two different example variable names, '$obj' under Solution and '$ob' under Discussion. (549) Item 'e' in the notes under Table 14-1; Change Provising you have an ANSI C compiler to Providing you have an ANSI C compiler (583) 3rd paragraph; Change: The simplest user interface is what we are called to, say: The simplest user interface is what are called (589) 2nd last paragraph; Change: module Term::Cap module to, say: Term::Cap module (626) See Also; 'The section on The section on "Talking to yourself" ...' should say: 'The section on "Talking to yourself" ...' (699) Bottom of the first 1/3 section of ex 17-6; Line 38 currently reads: if ($client = = $server) { Line 38 should read: if ($client == $server) { (699-700) Middle of ex 17-6; Lines 88-89 currently read: if ($rv = = length $outbuffer{$client} || $! = = POSIX::EWOULDBLOCK ) Lines 88-89 should read: if ($rv == length $outbuffer{$client} || $! == POSIX::EWOULDBLOCK )