Errata

All errata for Object Oriented Perl will be posted here. Many of the errata listed below have been incorporated into recent printings of Object Oriented Perl. Your book may contain some or all of these changes.

If you discover any mistakes in the book, you may post them in the Author Online Forum.


Technical Errata:

Page 23-24:

Various locations:

$dwarf[0]
should be
$dwarfs[0]
Likewise
$dwarf[1], $dwarf[2], etc.

Page 26:

the key "cat" is associated with the value "meow,"
should be:
the key "cat" is associated with the value "meow",

Page 27, first code block in the section "Iterating a hash":

print "The key $nextkey has the value $sound{$nextkey} \n";
should be:
print "The key $key has the value $sound{$key} \n";

Page 28:

The bodies of the two while loops at the top of the page are transposed. They should be:

while (defined($nextkey = each %sound))
{
  print "The key $nextkey has the value $sound{$nextkey} \n"
}
and later:
while ( ($nextkey,$nextval) = each %sound )
{
  print "The key $nextkey has the value $nextval \n"
}

Page 42:

"...will squash the contents of @ordered and the value of $newval..."
should be:
"...will squash the contents of @ordered and the value of $next_val..."

Page 51, footnote 21:

-Axn
should be:
-AXn

Page 53:

"% export PER5LIB"
should be:
"% export PERL5LIB"
Page 53, Footnote:
http://www.ozemail.com.au/~rpsavage/Perl-tutorials/tutorial1.html
should now be:
http://savage.net.au/Perl-tutorials/tutorial1.html

Page 72, in fifth bullet point:

$hsh_ref->[$key]
should be:
$hsh_ref->{$key}

Page 77:

In the 2nd to last paragraph, first line

"array referred to"
should be
"hash referred to"

Page 81:

Listing 3.1, in the "location" subroutine:

"$roomif" and "$shelfif"
should be
"$room if" and "$shelf if", respectively.
Also in listing 3.1, third line from the bottom:
$self->{_rating} = $rating if $rating;
should be:
$self->{_rating} = $rating if defined $rating;

Page 83:

CD::Music::title
should be:
CD::Music::name
and, Footnote 7:
"The concept of affordances comes from the work of user-interface guru Donald Norman. His landmark book..."
should be:
"The concept of affordances comes from the work of psychologist James Gibson, and was made popular by user-interface guru Donald Norman. Norman's landmark book..."

Page 90:

local STDOUT
should be:
local *STDOUT

Page 94:

Missing curly brace at the end of Listing 3.2


Page 100:

"The only problem occurs if main happens to have its own subroutine called name."
should be
"The only problem occurs if main happens to have its own subroutine called get_name."

Page 104, Line 9:

sub _class_default_keys { map { tr/_//d; $_ } keys %$_class_defaults}
should be:
sub _class_default_keys { map { s/^_//; $_ } keys %$_class_defaults}

Page 107, Top Line:

print "Title: ", $cd->title, "\n";
should be:
print "Title: ", $cd->name, "\n";

Page 115, in body of _default_for subroutine:

$_attr_data{$attr}[2]
should be:
$_attr_data{$attr}[0]

Page 121, in the subroutine "new":

my $self = bless [\%{"${class}::FIELDS"}], $class;
should be:
my $self = bless [], $class;

Page 127:

$pseudo_hash->{"a") = $newval;
should be:
$pseudo_hash->{"a"} = $newval;
Likewise:
$pseudo_hash->{"z") = $newval;
should be:
$pseudo_hash->{"z"} = $newval;

Page 134, in subroutine "new":

my %defs = $caller_is_obj ? %$caller_is_obj : %_default_data;
should be:
my %defs = $caller_is_obj ? %$caller : %_default_data;

Page 141:

my $is_prime = Bit::String->new(2,3,5,7,11);
my $isnt_lucky = ~$is_lucky;
should be:
my $is_prime = Bit::String->new(0,1,1,0,1,0,1,0,0,0,1);
my $isnt_lucky = ~$$is_lucky;

Page 177, Footnote 5:

$_ && $self->$_() for (map {$_->can("DESTROY")} @ISA);
should be:
$_ && $self->$_() for (map { !$self->{DESTROY}{$_}++ && $_->can("DESTROY")} @ISA);

Page 178, first comment of the "inherits" subroutine:

# Get object, name of prospective parent, and name of object's class...
should be:
# Get object, name of prospective ancestor, and name of object's class...

Page 186:

Delete the following two lines from sub METHOD::ABSTRACT:

die "someone used an (abstract) Has_Write object $loc"
    if $object_class eq 'Has_Write';

Page 191:

use fieldsqw
should be:
use fields qw
Also,
"However, that the module..."
should be:
"However, the module..."

Page 193, Code Sample, First Line of foreach block:

my ($argname) = ($argname =~
should be:
my ($argname) = ($attrname =~

Page 194, in subroutine "_default_for":

return $_attr_data{$attr}[2] if exists $_attr_data{$attr};
should be:
return $_attr_data{$attr}[0] if exists $_attr_data{$attr};

Page 195, last paragraph (various places):

_assessible
should be:
_accessible

Page 218, Code Sample at top of 8.1.3, First Line:

struct BugType =>           # type attribute referes to BugType object
should be:
struct BugType =>
Also,

Code Sample at top of 8.1.3, Third to Last Line:

onject
should be
object

Page 233, Section 8.2.11, Second Paragraph:

Missing second semicolon:

"The constructors created by Class:MethodMaker"
should be:
"The constructors created by Class::MethodMaker"

Page 248:

$xref{$1} = { %{$xref{$1}|{}}, $page_num => 1 }
should be:
$xref{$1} = { %{$xref{$1}||{}}, $page_num => 1 }

Page 250:

"...to create a messenger DNA (mDNA) strand..."
should be:
"...to create a messenger RNA (mRNA) strand..."
Likewise,
"...match up transer DNA (tDNA)..."
should be:
"...match up transfer RNA (tRNA)..."

Page 260:

If some future version of Perl does finally enable tied filehandles to recognize and make use of an OPEN method, the arguments that method will require will be the same as for the built-in read or sysread functions, *not* the ones we're using here.
should be:
If some future version of Perl does finally enable tied filehandles to recognize and make use of an OPEN method, the arguments that method will require will be the same as for the built-in open function, *not* the ones we're using here.

Page 272:

$blessedfile = IO::Filtered->new(file=>">passwd", out=>&encrypt;
should be:
$blessedfile = IO::Filtered->new(file=>">passwd", out=>&encrypt);

Page 285:

"+0" => sub { $_[0]->{val} },
should be:
"0+" => sub { $_[0]->{val} },

Page 307:

    my $private1 = Soldier->new( name => "Smith, J", 

                                rank => "Private");
should be:
    my $private = Soldier->new( name => "Smith, J", 

                               rank => "Private");


 
 

Page 329, end of subroutine "List::generate_insert":

   splice @{$L->{elements}}, $index, 0, $E;
  }
}
should be:
    splice @{$L->{elements}}, $index, 0, $E;
    $L->{current} = $index;
  }
}

Page 336, Section 12.3.1, Paragraph 1, Last Sentence:

"trees to store kinds of nodes"
should be:
"trees to store different kinds of nodes"

Page 341 2nd paragraph, 1st line:

compare
should be:
_compare

Page 345:

In the subroutine "insert", delete the second statement, namely:

return if defined $self->{value} && $self->{value} == $newvalue;

Page 364:

The dashed vertical arrows next to the words "MovableWindow" and "ResizableWindow" on the LHS of Figure 13.2 should point upwards, not downwards.


Page 374, 3rd Paragraph from Bottom:

(A_Child, A_Child, A_Child) than to (A_Parent, A_Parent, A_Parent)
should be:
(A_Child, B_Child, C_Child) than to (A_Parent, B_Parent, C_Parent)

Page 377, Listing 13.6, Lines 13-16:

package D_OtherParent;
use Class::Multimethods;

     multimethod multi => (D_Parent)
          => sub { print "dispatched to D_Parent::multi\n" };

     sub poly { print "dispatched to D_Parent::poly\n" };

should be:
package D_OtherParent;
use Class::Multimethods;

     multimethod multi => (D_OtherParent)
          => sub { print "dispatched to D_OtherParent::multi\n" };

     sub poly { print "dispatched to D_OtherParent::poly\n" };


Page 379, Paragraph 1:

"the receive_event variants in figure 13.6 are all defined"
should be:
"the receive_event variants in listing 13.4 are all defined"

Page 398:

Perl and awk offer explicit BEGIN, INIT, and END blocks
should be:
Perl and awk offer explicit BEGIN and END blocks

Page 408: (remove semi-colon from end of 1st and 3rd lines of code):

        Contact::Persistent::Personal->persistent( '$therapist' );

            or $therapist = Contact::Persistent::Personal->new(%shrink_data);

        Contact::Persistent::CIA->persistent( '$agent_x' );

            or $agent_x = Contact::Persistent::CIA->new(%classified_data);
should be:
        Contact::Persistent::Personal->persistent( '$therapist' )

            or $therapist = Contact::Persistent::Personal->new(%shrink_data);

        Contact::Persistent::CIA->persistent( '$agent_x' )

            or $agent_x = Contact::Persistent::CIA->new(%classified_data);

Page 411, Paragraph 4, Sentence 1:

Delete extraneous ")" after %pers_var


Literary Errata:

Page xii, line 3.
to built
should be:
to build

Page 16:

"...the behavior is inappropriate, and different..."
should be:
"...the behavior is appropriate, and different..."

Page 18, Table 1.1:

generic:method
should be:
generic method



Page 19:

"This section distils that bounty to three books,"
should be:
"This section distils that bounty to four books,"

Page 24:

a character string that don't contain a whitespace character
should be:
a character string that doesn't contain a whitespace character

Page 31, top of page:

But this version acts like the previous...
should be:
This version acts like the previous...

Page 37:

You can also take references to array, hashes, and typeglobs
should be:
You can also take references to arrays, hashes, and typeglobs

Page 52:

(see "Importing from a module" below)
should be:
(see "Export control in modules" below)

Page 54, footnote 24:

...which is lives in the UNIVERSAL package.
should be:
...which lives in the UNIVERSAL package.

Page 55:

catchall
should be:
catch-all

Page 68, 6th Line from the Top:

The word "CPAN" should not be set in Ancient Greek.

and:

... a relevant subset of the Perl.
should be:
... a relevant subset of Perl.

Page 69 (and p.466):

Effective Perl Programming, by Joseph Hall and Randal Schwartz
should be:
Effective Perl Programming, by Joseph Hall with Randal Schwartz

Page 77:

"The anonymous array referred to by $nextbug"
should be:
"The anonymous hash referred to by $nextbug"

Page 78:

Here it's used to suggest that attributes and methods that are to be treated as not for public use.
should be:
Here it's used to suggest that such attributes and methods should be treated as Not For Public Use

Page 80:

strucured
should be:
structured

Page 82:

...to provide access to attributes
should be:
...to provide access to attributes.

Page 85, end of first paragraph:

syntax).
should be:
syntax.

Page 89, Paragraph 7, Line 3:

"subroutines names to be exported"
should be
"subroutine names to be exported"

Page 90:

First comment of second code snippet:

unavailble
should be:
unavailable

Page 99:

...that sometime befuddles print.
should be:
...that sometimes befuddles print.

Page 110:

The stubborn Nodes and Links form a chain, in which....
should be:
The stubborn Nodes and Links form a cycle, in which....

Page 114:

To round out this first taste to object-oriented Perl...
should be:
To round out this first taste of object-oriented Perl...

Page 119:

readable object attributes labels
should be:
readable object attribute labels

Page 144:

"at compiletime"
should be
"at compile time"

Page 150:

is largely be a matter of personal taste
should be:
is largely a matter of personal taste

Page 162:

returns a reference to anonymous typeglob.
should be:
returns a reference to an anonymous typeglob
and:
All then required is to arrange for the child process to grab...
should be:
All that is then required is to arrange for the child process to grab...

Page 166:

placing a reference into a scalar to the appropriate slot of the typeglob referred to by $self.
should be:
placing a reference to a scalar in the appropriate slot of the typeglob referred to by $self.

Page 170, footnote 1:

parent's
should be:
parents

Page 175:

Even when all those conditions are met, one case that requires extra care:
should be:
Even when all those conditions are met, one case requires extra care:

Page 191:

"However, that the base.pm module..."
should be:
"However, the base.pm module..."

Page 196, 1st paragraph of "Accessing the right class attribute":

That was why we used the two-argument form bless.
should be:
That was why we used the two-argument form of bless.

Page 200:

It prompts the reader to ponder and and gain a better understanding
should be:
It prompts the reader to ponder and gain a better understanding
and Footnote:
"intervening line of code in between."
should be:
"intervening line of code."

Page 222, Footnote, First Line:

"resulting code looks"
should be:
"resulting code look"

Page 265:

fingerprint, and so forth. to them.
should be:
fingerprint, and so forth to them.

Page 270, Footnote:

Remove space after 'masochist' and before the period.


Page 273:

...into IO::Filtered; the typeglob merely tied to the package.
should be:
...into IO::Filtered; the typeglob is merely tied to the package.

Page 275:

it's destructor is called.
should be:
its destructor is called.

Page 283:

Incorrect closing quotation mark:

``numerification"
should be:
``numerification''
and:
Others such contexts include:
should be:
Other such contexts include:

Page 285, Footnote 5:

Incorrect closing quotation mark:

``truth"
should be:
``truth''

Page 287, Footnote, Second Sentence:

"They will also will help with"
should be:
"They will also help with"

Page 291:

Incorrect closing quotation mark:

``reference semantics"
should be:
``reference semantics''
and
``value semantics"
should be:
``value semantics''
Also, in footnote 10:

Incorrect closing quotation mark:

``[he or she] has said"
should be:
``[he or she] has said''

Page 293:

Clearly for such a class "x" is ...
should be:
Clearly, for such a class, "x" is ...

Page 295:

Overloaded operators allows Perl objects...
should be:
Overloaded operators allow Perl objects...

Page 309, Paragraph 4, Sentence 1:

"having to manufacturing"
should be:
"having to manufacture"

Page 315:

The "__handle" entry is be skipped
should be:
The "__handle" entry is skipped
and:
The loop executes a package derived...
should be:
The loop executes in a package derived...

Page 340:

...value returned by compare indicates the name of child node...
should be
...value returned by _compare indicates the name of the child node...

Page 341:

...In a method, that means the assignment $_ [0] = undef assigns an undefined value....
should be:
...In a method, that means the assignment $_[0] = undef assigns an undefined value....

Page 342, Caption:

Figure 12.1 Deleting a left-most note without...
should be
Figure 12.1 Deleting a left-most node without...

Page 343:

Thus if we wanted to use numerical keys, we need to create...
should be:
Thus if we want to use numerical keys, we would need to create...
also:
Instead, we might chose to restructure...
should be:
Instead, we might choose to restructure...

Page 348:

...and the heap kept as small as possible.
should be:
...and the heap is kept as shallow as possible.

Page 351:

"What happens next depends not only on the type of window and, also, on the type of event."
should be:
"What happens next depends not only on the type of window but also on the type of event."

Page 370, Footnote 7:

"tests-in_methods"
should be:
" tests-in-methods"

Page 373, 3rd Paragraph from Bottom:

"dispatchedto"
should be:
"dispatched to"

Page 388, Section 14.1.1, Paragraph 2, Sentence 1:

Delete extraneous ")" at end of sentence.


Page 389, Paragraph 3, Last Sentence:

"with a unique key if we store"
should be:
"with a unique key, if we store"

Page 391:

into encoding and requires only 73 bytes
should be:
into $encoding and requires only 73 bytes
(and $encoding should be set in the fixed-width code font)

Page 392:

...to an remarkably compact 74 bytes...
should be:
...to a remarkably compact 74 bytes...

Page 393:

...Berkley DB format...
should be:
...Berkeley DB format...

Page 397, Paragraph 2, Sentence 1:

"same end ofstoring"
should be:
"same end of storing"
and:
...so other application only have read access...
should be:
...so other applications only have read access...

Page 401, Title of Listing 14.1:

"A non-persistence contacts class"
should be:
"A non-persistent contacts class"
and:
The print method prints out an object's data
should be:
The print method prints out an object's data.

Page 402:

"SDBM_File", etc.).
should be:
"SDBM_File", etc.)

Page 404, Section 14.3.2, Paragraph 2:

"the END bloc"
should be:
"the END block"

Page 408, Paragraph 2, Sentence 2:

"For each key it uses Data::Dumper"
should be:
"For each key, it uses Data::Dumper"
Also,

Section 14.3.3, Paragraph 1, Sentence 1:

"two goal"
should be:
"two goals"

Page 411, Paragraph 4, Last Sentence:

${$symname}, @{$symname}, or %{$symname}

(in each case the curly brackets should be bold).


Page 413, Section 14.4.1, Paragraph 2, Last Sentence:

"also provide have"
should be:
"also provide"

Page 414, Paragraph 3, Sentence 1:

"a filehandle or rather, the"
should be:
"a filehandle, or rather the"

Page 420, Paragraph 1, Sentence 1:

"decode again them again"
should be:
"decode them again"
Also,

Paragraph 2, Sentence 2:

"Thereafter the object"
should be:
"Thereafter, the object"

Page 439, Paragraph 2, Sentence 1:

"- that is something that has a unique identity"
should be:
"- that is, something that has a unique identity"

Page 450, Section B.3.2, Paragraph 2, Sentence 2:

"higher level that Perl packages"
should be:
"higher level than Perl packages"

Page 451:

...access to every component of its each of its ancestors.
should be:
...access to every component of each of its ancestors.

Pages 454 and 467:

David Flanaghan
should be:
David Flanagan

Page 455, Section B.4.3, Paragraph 5, Sentence 3:

"Perl does not provide an built-in"
should be:
"Perl does not provide a built-in"

Page 457, Paragraph 1, Sentence 1:

"variables have not associated"
should be:
"variables have no associated"

Page 478:

Delete redundant index entry:

goto_& 264

Page 478:

Insert missing index entry:

Guttman, Uri xviii