Mastering Perl/Tk by Nancy Walsh, Stephen Lidie This errata page lists errors outstanding 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 2, 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 Confirmed errors: This book's author is also keeping an errata file which can be found at: http://www.lehigh.edu/~sol0/ptk/mptk-ed1-errata.html (xiv) In the footnote: Laundry list should also contain "references". (9) Paragraph before last code snippet on page.; "... (each of which create a Button widget ..." should be "... (each of which creates a Button widget ..." (23) first line; missing the trailing quote mark on the fourth -side option, 'bottom'. (40) Last paragraph: "This sample" -> "The next example" is more clear. (71) 6th paragraph; "you programs." => "your programs." [76] The dynamic font viewing program fails to properly account for fonts with embedded spaces. It tries to use tags whose values are the font name, but it's illegal to have tags with spaces, so a second variable is required that is the font name minus embeded spaces. The corrected program is available from my always the most recent examples tar file. http://www.lehigh.edu/~sol0/ptk/mptk-code/mptk-code-changes.html {86} In table, entry -relief: "Default for Button is 'raised'." is missing. (117) 2nd and 3rd line of "The Entry Widget"; the "-" sign at the end of line belongs to "command" at the beginning of the next line; shouldn't be separated. (119) 'active' is not a legal value for the -state option. (131) Above figure 5-15: "In this case, 50% of the text...", 50 must be changed to 20. (143) Figure 6-12: "80% into data", 80% must be changed to 90%. {149} 2nd to last paragraph mentions user-contributed "multi-Listbox" widgets. Actually, we do not talk about user contributed wigets, for the reasons discussed in Chapter 23, section "Widgets Not in the Perl/Tk Distribution", page 583. {149} mentions the TextList widget, which we regrettably fail to explicitly document. Please refer to the section "The Perl/Tk Text Widget Extended Methods" on page 188. {159} Footnote to last sentence "So , when might we bind to this event?" is on page 160. (163) List of options, entry "-height": "Sets the height of the widget.", add "in lines of text" for clarification. {174} 1st line of code after Selections in a Text Widget...; $if should be if (177) First line: "... shows a psuedo-link example." Should be "pseudo". {195} Figure 9-2: Either "Y = -100" or draw the figure upside down! Actually, the figure needs a total overhaul ... (197) third paragraph: "... this one small annoyance, bind works just..." "bind" should be "CanvasBind". (225) Suggestion: Heading "Scale Options" is missing before the list. {248} reference to Fig 11-3 is correct, but the actual figure is missing. Renumber subsequent figures and cross-references. Figure 11-3 can be found at: http://examples.oreilly.com/mastperltk/fig_11-3.gif (290) Fourth paragraph: "Note that this is the only widget we know", "widget" should be "widget method". [300] replace paragraph seven in it's entirety (The order in which the focus moves around matches .... on to the next one (e.g., a Text widget.) with: "The order in which the focus moves depends on the stacking order of the widgets, as described in the previous section, Focus Methods". (324) Caption Figure 14-7: "Smal, purple text". "Smal" should be "Small". (346) "solutionand" => "solution, and" (359) 3rd paragraph (not counting example code and message text); In the sentence that begins "This form us used more often in binding commands" the second "it's" should have no apostrophe. (361) "know as an event descriptor" => "known as an event descriptor" (372) In the middle of the code listing, "Which yields:" wrong font (should be normal text) and wrong indentation. [378] example in section titled "Executing Nonblocking System Commands" - (I wouldn't characterize this a 'serious technical mistake' so much as an 'important caveat', but then, I'm not the sysadmin...) The method of opening a file handle to a 'tail -f' pipe and waiting for it to become readable with the 'fileevent' method works well (thank you!) -- HOWEVER, on some (most? all?) systems (e.g., Solaris 7) the 'tail' subprocess survives the [normal] termination of the perl program itself. In addition to the obvious matter of spawning immortal processes, this can lead to problems when the file becomes readable and the output file for 'tail' (the aforementioned pipe) no longer exists. (On NFS mounted filesystems, a '.nfs' file is created in the current working directory that only be removed by logging onto the [file]host system to delete it.) I would suggest that users make sure any 'piped' subprocesses are killed before the file handles are closed. My choice of method is to set the process group id of the current process, allowing me to kill all subprocesses without knowing their process id's explicitly (refer to 'setpgrp', 'kill' commands in 'Programming Perl' book). AUTHOR: You make several great points, which will make it into the next printing of Mastering Perl/Tk. I'll probably just hint at the problems here and point readers to the discussion of the Tk::ExecuteCommand widget, where the problems are already solved. (393) Third paragraph: "The foreach loop creates the actual watchpoint objects, using our callbacks ...". "callbacks" is possessive, so make that "callback's". (393) last line: "why waitVariableX is returned" => "why waitVariableX returned". (394) In the splashscreen pseudo-code, the call to waitVariableX has a leading & character - remove it. {424} In the section "Cool Tricks with an Empty Bitmap", the use of the term "transparent" was unfortunate. The bitmap is not really transparent, rather, it always takes on the same color as the background, so it's simply invisible. To be really transparent, the value for trans_cur_bits[] in the mask should read "0x00" and not "0x01". As you can see from the example in the previous section, bitmap and mask work like this: bitmap mask shown color 0 0 transparent 1 0 transparent 0 1 bitmap's -background 1 1 bitmap's -foreground So only if all mask bits are set to "0" can the cursor be transparent. (446) Second paragraph: "Here is the cod that...", "cod" should be "code". {575} In the list of options, entry "-choices": "... or -choices => @init_choices", "@init_choices" should be "\@init_choices". {569} -initialfile => filename; filename must NOT include a path! AUTHOR: For an errata, please add the following sentence to the description of -initialfile: "This value cannot be a path name, but must be a simple filename, which is relative to the initial directory, whether it be the current working directory or the value specified by the -initialdir option." {571} Code listing; On this line of code in the listing for the Balloon Widget: $msgarea = $mw->Label(-borderwidth => 2, -relief => 'groove')->pack(-side => 'bottom', fill => 'x'); should be: $msgarea = $mw->Label(-borderwidth => 2, -relief => 'groove')->pack(-side => 'bottom', -fill => 'x'); The "fill" needs to be "-fill" in order for the code to work. (586) last paragraph; explain how to use PPM through a proxy or firewall: If you use a proxy server or firewall, PPM may fail. Generally, you can workaround the problem by setting the environment variables HTTP_proxy, HTTP_proxy_user and HTTP_proxy_pass before invoking PPM. If this also fails, you can fetch packages from ActiveState's repository and install them locally. For complete details, see http://aspn.activestate.com//ASPN/Reference/Products/ActivePerl/faq/ActivePerl-faq2.html. For example: SET HTTP_proxy=http://proxy:8080 SET HTTP_proxy_user=proxyun SET HTTP_proxy_pass=proxypw Note: There are many errors in the index. Since O'Reilly has made a corrected index available (see below), I've removed all index errata except those that are not reflected in the new index. Index, pages 717 - 746 In the first printing of Mastering Perl/Tk (dated January 2002), the index had many errors due to a merge conflict. We include a corrected index both in HTML (http://www.oreilly.com/catalog/mastperltk/inx.html) and in PDF (http://www.oreilly.com/catalog/mastperltk/pdf/mastperltk_index.pdf). Please accept our apologies for any inconvenience this has caused you. Future printings of Mastering Perl/Tk will have the corrected index incorporated into the book. (717) 2nd column, near bottom; Index entry for "after" says page 287, but there is no reference to "after" on that page. Should be pages 357, 389. {729} Under the "images" index entry "creating 200", change it to "creating 204, 417". (731) 2nd column, LabEntry widget index; Reference to page 113 is incorrect. Proper page is 132. (736) Under the "properties, window manager" index entry, page shows 234, but should be "238, 243". (737) first column; The index lists the page for the "repeat method" as 287, it should be 306 (737) 2nd column, ROText widget index; Reference to page 184 is incorrect. Proper page is 193. {741} The "TextUndo Widget" index entry should point to page 191 not 184. {744} Under the "virtual events" index entry "TextUndo widgets and, 184", change the page number to 192. {746} The index entries for the window manager properties WM_CLIENT_MACHINE, WM_DELETE_WINDOW, WM_SAVE_YOURSELF and WM_TAKE_FOCUS show page 234 - make that page 243. {746} The index entries for the window manager properties WM_COLORMAP_WINDOWS and WM_COMMAND show page 234 - make that page 244. {746} The index entry for WM_PROPERTY_THING should read 238.