Errata

Mastering Perl/Tk

Errata for Mastering Perl/Tk

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 xiv
In the footnote: Laundry list should also contain "references".

Anonymous   
Printed
Page 9
Paragraph before last code snippet on page.

"... (each of which create a Button widget ..." should be "... (each of which creates
a Button widget ..."

Anonymous   
Printed
Page 23
first line; missing the trailing quote mark on the fourth -side option, 'bottom'.

Anonymous   
Printed
Page 32
lines 4-5; "which widget should be placed after your new widget."

NOW READS:
"which widget your new widget should be placed after."

Anonymous    Mar 01, 2004
Printed
Page 38
In the top portion of code sample, the line $i = 0; HAS BEEN DELETED.

Anonymous    Mar 01, 2004
Printed
Page 39
In the listing: lines 24 (my $b =...) to 26 ($b->packForget;) HAVE BEEN DELETED.

Anonymous    Mar 01, 2004
Printed
Page 40
Last paragraph: "This sample" -> "The next example" is more clear.

Anonymous   
Printed
Page 40
In the listing: last lines in procedure "addwidget" ($top->Button(...):

The line "-anchor => $anchordirs[$count]" HAS BEEN ADDED after the '-font' line.

Anonymous    Mar 01, 2004
Printed
Page 68
last if statement in example code

if ($rightspring ne '') { push (@args, ('-rightspring', $rightspring)); }

NOW READS:
if ($leftspring ne '') { push (@args, ('-leftspring', $leftspring)); }

Anonymous    Mar 01, 2004
Printed
Page 71
6th paragraph; "you programs." => "your programs."

Anonymous   
Printed
Page 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

Anonymous   
Printed
Page 86
In table, entry -relief: "Default for Button is 'raised'." is missing.

Anonymous   
Printed
Page 90
In last paragraph of section

"Using -relief with -indicator => 0 is..."

NOW READS:
"... -indicatoron => 0 ...".

Anonymous    Mar 01, 2004
Printed
Page 95
In the listing: line 13 "$_->pack('forget')"

NOW READS : "$->packForget".

Anonymous    Mar 01, 2004
Printed
Page 96
Example of disabling a Button, use cget() rather than configure() to fetch an option

value. Line 5 of the code sample NOW READS:

-command => sub {my $state = $exit_b->cget(-state);

Anonymous    Mar 01, 2004
Printed
Page 113
Description of -foreground option NOW READS

Changes the text of the Label (or the bitmap) to color.

Anonymous    Mar 01, 2004
Printed
Page 116
In the sample code: "-textvariable => $message,)" an extraneous trailing comma HAS BEEN DELETED.

Anonymous    Mar 01, 2004
Printed
Page 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.

Anonymous   
Printed
Page 119
'active' is not a legal value for the -state option.

Anonymous   
Printed
Page 131
Above figure 5-15: "In this case, 50% of the text...", 50 must be changed to 20.

Anonymous   
Printed
Page 143
Figure 6-12: "80% into data", 80% must be changed to 90%.

Anonymous   
Printed
Page 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.

Anonymous   
Printed
Page 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.

Anonymous   
Printed
Page 151
List of options: "-takefocus => 0|1|undef", the default "undef" NOW APPEARS in bold.

Anonymous    Mar 01, 2004
Printed
Page 159
Footnote to last sentence "So , when might we bind to this event?" is on page 160.

Anonymous   
Printed
Page 163
List of options, entry "-height": "Sets the height of the widget.", add "in lines of

text" for clarification.

Anonymous   
Printed
Page 174
1st line of code after Selections in a Text Widget...

$if
should be
if

Anonymous   
Printed
Page 177
First line: "... shows a psuedo-link example." Should be "pseudo".

Anonymous   
Printed
Page 178
First paragraph, list of bindings: "<F1>Invokes...", A space HAS BEEN INSERTED between "<F1>" and

"Invokes". (Also for the other three lines in that section.)

Anonymous    Mar 01, 2004
Printed
Page 195
Figure 9-2: Either "Y = -100" or draw the figure upside down! Actually, the figure needs a

total overhaul ...

Anonymous   
Printed
Page 197
third paragraph: "... this one small annoyance, bind works just..." "bind" should be

"CanvasBind".

Anonymous   
Printed
Page 204
-image option; "See Chapter 3"

NOW READS: "See Chapter 17"

Anonymous    Mar 01, 2004
Printed
Page 214
The example $c->find('withtag', '(a&&!b)|(!a&&b)') was missing one '|'.

It NOW READS:
$c->find('withtag', '(a&&!b)||(!a&&b)').

Anonymous    Mar 01, 2004
Printed
Page 216
Section "Getting Tags from a Specific Item"

"If the tag/id doesn't match anything, an empty string is returned."

"empty string" NOW READS "empty list".

Anonymous    Mar 01, 2004
Printed
Page 217
The bounding box example showed the query result as ($l, $r, $t, $b), which was incorrect.

The result is a list of two diagonal coordinates and NOW READS($x1, $y1, $x2, $y2).

Anonymous    Mar 01, 2004
Printed
Page 225
Suggestion: Heading "Scale Options" is missing before the list.

Anonymous   
Printed
Page 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/9781565927162/fig_11-3.gif

Anonymous   
Printed
Page 275
In Tk800.023 -variable no longer works. In the Optionmenu example, -variable

HAS BEEN CHANGED -textvariable.

Anonymous    Mar 01, 2004
Printed
Page 277-278
Two lines in the native optiomenu program were incorrect On page 277, third line of the program:

my($parent, $varref, $callback, @optionvals) = @_;

NOW READS:
my($parent, $varref, $command, @optionvals) = @_;

And on page 278, 19 program lines down: "-command => [$callback, $_]"

NOW READS:
"-command => [@$callback, $_]".

Anonymous    Mar 01, 2004
Printed
Page 290
Fourth paragraph: "Note that this is the only widget we know",

"widget"
should be
"widget method".

Anonymous   
Printed
Page 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".

Anonymous   
Printed
Page 313
Eighth paragraph starting with "Line 20 ... in our sample code ... options => [1..5]",

"[1..5]" NOW READS "[1..2]"

Anonymous    Mar 01, 2004
Printed
Page 324
Caption Figure 14-7: "Smal, purple text". "Smal" should be "Small".

Anonymous   
Printed
Page 329
To get the output as shown on the end of the page the code HAS BEEN CHANGED from

"foreach (keys %{..." to "foreach (sort keys %{...".

Anonymous    Mar 01, 2004
Printed
Page 346
"solutionand" => "solution, and"

Anonymous   
Printed
Page 348
Code line after 3rd paragraph: "ldifference [keys %SHAPE], @{$LLCD{$_}} ]",

"@{...}" NOW READS "$LLCD{$_}".

Anonymous    Mar 01, 2004
Printed
Page 355
The "make test" example following the second paragraph, "This automatically creates

MANIFEST and test.pl for us. Now type this:", the command following this sentence:

NOW READS:
% make dist

Anonymous    Mar 01, 2004
Printed
Page 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.

Anonymous   
Printed
Page 361
"know as an event descriptor" => "known as an event descriptor"

Anonymous   
Printed
Page 372
In the middle of the code listing, "Which yields:" wrong font (should be normal text)

and wrong indentation.

Anonymous   
Printed
Page 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.

Anonymous   
Printed
Page 393
Third paragraph: "The foreach loop creates the actual watchpoint objects, using our

callbacks ...". "callbacks" is possessive, so make that "callback's".

Anonymous   
Printed
Page 393
last line: "why waitVariableX is returned" => "why waitVariableX returned".

Anonymous   
Printed
Page 394
In the splashscreen pseudo-code, the call to waitVariableX has a leading & character -

remove it.

Anonymous   
Printed
Page 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.

Anonymous   
Printed
Page 446
Second paragraph: "Here is the cod that...", "cod" should be "code".

Anonymous   
Printed
Page 543
2nd paragraph; the name Grant Hopwell NOW READS Grant Hopwood.

Anonymous    Mar 01, 2004
Printed
Page 543
4th paragraph; The noted module (Win32::MemMap) is not available from

the previously listed location (http://www.generation.net/~aiminer/Perl) or from CPAN.
In addition, the other module required (Tie::Win32MemMap) doesn't appear there or on CPAN.

The modules are available either from http://www.Lehigh.EDU/~sol0/ptk/ptk.html or
http://jenda.krynicky.cz/perl/. These references HAVE BEEN CHANGED in the text.

Anonymous    Mar 01, 2004
Printed
Page 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."

Anonymous   
Printed
Page 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.

Anonymous   
Printed
Page 575
In the list of options, entry "-choices": "... or -choices => @init_choices",

"@init_choices" should be "@init_choices".

Anonymous   
Printed
Page 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/9781565927162/inx.html)
and in PDF (http://www.oreilly.com/catalog/9781565927162/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.

Anonymous   
Printed
Page 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.

Anonymous   
Printed
Page 729
Under the "images" index entry "creating 200", change it to "creating 204, 417".

Anonymous   
Printed
Page 731
2nd column, LabEntry widget index; Reference to page 113 is incorrect. Proper page

is 132.

Anonymous   
Printed
Page 736
Under the "properties, window manager" index entry, page shows 234, but should be

"238, 243".

Anonymous   
Printed
Page 737
first column

The index lists the page for the "repeat method" as 287, it should be 306

Anonymous   
Printed
Page 737
2nd column, ROText widget index; Reference to page 184 is incorrect. Proper page is 193.

Anonymous   
Printed
Page 741
The "TextUndo Widget" index entry should point to page 191 not 184.

Anonymous   
Printed
Page 744
Under the "virtual events" index entry "TextUndo widgets and, 184", change the page

number to 192.

Anonymous   
Printed
Page 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.

Anonymous   
Printed
Page 746
The index entries for the window manager properties WM_COLORMAP_WINDOWS and WM_COMMAND

show page 234 - make that page 244.

Anonymous   
Printed
Page 746
The index entry for WM_PROPERTY_THING should read 238.

Anonymous