Errata

Intermediate Perl

Errata for Intermediate Perl

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.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.

Color Key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted by Date submitted
Printed Page 1
147

We use the FOLDED
key to describe what the sort value represents:
my @output_data =
map $_−>{ORGINAL},
sort { $a−>{FOLDED} cmp $b−>{FOLDED} }
map { ORIGINAL => $_, FOLDED => "\F$_" ],
@input_data;


should be change "]" into "}"
my @output_data =
map $_−>{ORGINAL},
sort { $a−>{FOLDED} cmp $b−>{FOLDED} }
map { ORIGINAL => $_, FOLDED => "\F$_" },
@input_data;

wei zhong  Oct 25, 2019 
PDF Page 15
3rd paragraph

For any recent version of Perl (higher than 5.005), the patch level contains three numbers, not two, so it is just like the minor version.

For instance, the correct way to obtain CPAN version for Perl 5.14.2 would be:

print $Module::CoreList::version{5.014002}{CPAN}; # 1.9600_01

The following would not yield correct result:

print $Module::CoreList::version{5.01402}{CPAN}; # not right

Grzegorz Szpetkowski  Jul 11, 2016 
PDF Page 39
2nd code

my $second_ref_to_skipper = $reference_to_skipper;

The correct reference is not being copied. It should be following:

my $second_ref_to_skipper = $ref_to_skipper;

Anonymous  Dec 17, 2014 
Printed, PDF, ePub Page 42
4th paragraph

The 4th paragraph states "The second element is a reference to the correct provisions array, which we use in the grep expression".

The previous expression is:
my %whos_items = map {$_, 1} @{$_[1]};

'grep' in the paragraph should be 'map'.

Paul Trost  Jul 18, 2014 
PDF Page 42
2nd para under Getting Our Braces Off

"We could drop the braces from @{$items} and @{$$items} though."

The second syntax in the above line should be ${$items}[1]

Rajesh Amradi  May 06, 2015 
PDF Page 42
4th paragraph

Instead of:

"The second element is a reference to the correct provisions array, which we use in the grep expression."

it shall be:

The second element is a reference to the correct provisions array, which we use in the map expression."

Grzegorz Szpetkowski  Aug 12, 2016 
Printed Page 44
First code section

It looks like @skipper_with_name contains a hash (=>) rather than an array with two elements. Half way down the page is stated "each of which is an ARRAY with two elements" (my emphasis). Please clarify.
Thanks, Bob
(great book BTW).

Bob Evans  Jul 21, 2014 
Printed Page 44
First code section

The second line of code shows
my @skipper_with_name = ('Skipper' => \@skipper);
The arrow should be a comma since @skipper_with_name is an array, not a hash. This error is repeated on the 4th and 6th lines of code. The text later says @skipper_with_name has two elements..., consistent with this correction.

Gary Hardin  Aug 29, 2014 
PDF Page 47
code samples beneath Fig. 4.9

This also occurs in the middle of page 49 - I didn't look for further examples.

Stray spaces appear between the sigils ($ and %) and the variable names. For example

my $name = $ gilligan_info { 'name' };

should be

my $name = $gilligan_info { 'name' };

Glenn Becker  Jan 10, 2015 
Printed Page 51
4th code example

sub is_hash_ref in last code example on page has 'my $hash_ref', but then in the eval and croak uses $ref_type instead.

sub is_hash_ref {
my $hash_ref = shift;

return eval { keys %$ref_type; 1 };
}

croak "I expected a hash reference!"
unless is_hash_ref( $ref_type );

Paul Trost  Jul 22, 2014 
PDF Page 52
excercise 3

Exercise, downloadable code and answer (p 317) are out of sync: exercise asks report for 4 castaway, answer lists 3 and draft dowloadable code has only 2 (missing both Howells, who must be key figures, because you need locate on some other place). Also, downloadable code lists character's properties. It makes feel, that something is wrong there.

Wanradt Koell  Mar 31, 2015 
PDF Page 53
Second code section

change

my $second_ref_to_skipper = $reference_to_skipper;

to

my $second_ref_to_skipper = $ref_to_skipper;


in the first code section , the reference to @skipper is $ref_to_skipper. I think it is a typo here.

zhang pengcheng  Sep 22, 2014 
Printed Page 79
$string contents at top of page

"The text in string ..... :"
"$VAR 1 = [ ..."

I see two errrors, but rather than pointing out each one, it's simpler to note that the correct contents of $string after the program is executed would be exactly what Dumper() produced, as seen on pages 76 & 77. The programs are identical, except that first one calls print() on the result of Dumper() and the second assigns what Dumper() returns to $string.

Gregory Sherman  Aug 24, 2017 
Printed Page 79
@data1 at bottom of page

"@data1 = ( ..." output does not match what is produced by program

Replace \@data1 with []
Add $data1[2][3] = \@data1; as next-to-last line of output - below );

Gregory Sherman  Aug 24, 2017 
Printed, PDF, ePub Page 86
1st paragraph

Text states "including the to_json:", the 'the' should be removed.

Paul Trost  Jul 23, 2014 
Printed Page 106
4th code sample

On page 106 the 4th code sample, has $countdown('main')--; as the last line of subroutine add_to_tab. Is this a typo or do I not understand the code example?

Patrick Clot  Feb 01, 2016 
Printed Page 106
bottom half of page

There is a significant discrepancy in regatds to "state":

text in 3rd paragrah:
"So far, we can initialize only scalar variables with state. We can declare other types of variables, but we can't initialize them."

vs last code segment:
state %tab = map{$_, 0} @$castaways; #works!

Perhaps the variable should be $tab

Gregory Sherman  Sep 20, 2017 
PDF Page 120
las example

This example sets minimum version of perl 5.10, but actually this code is meant for older version (where state is not available).

Wanradt Koell  Apr 03, 2015 
PDF Page 124
Code after first para

"# reads from $read_fh, prints to $log_gh and $scalar_fh"

It should be $log_fh

Rajesh Amradi  May 10, 2015 
PDF Page 124
Last line

"We put the pipe in front of $command to show that data are coming into our program:"

to show that the data are coming from our program

Rajesh Amradi  May 10, 2015 
Printed Page 132
footnote

The URL provided does not work. The correct page appears to be:
http://www.effectiveperlprogramming.com/2010/04/know-the-difference-between-regex-and-match-operator-flags/

Nigel Peck  Sep 06, 2013 
PDF Page 133,134,135
@patterns in the two code examples

In the array of patterns, the last regex has to be qr/Mrs?\. Howell/ instead of qr/Mrs?. Howell/
Assuming, the pattern should match Mr. Howell or Mrs. Howell

Rajesh Amradi  May 10, 2015 
Printed Page 135
1st code example

the variable, $position, in the while block should be rexical.

If the variable is not rexical, It will try to use it outside of subroutine.

John Kang  Apr 09, 2015 
Printed Page 139
4th paragraph 2nd line

Two or them have an r as the second letter.

Base on the context, this sentence must be:

Tow of them have ....

hanlei  Jun 17, 2013 
PDF Page 139
1st code syntax under Assembling Regular Expressions

"my $passenger = qr/(?:Mr. Howell|Mrs. Howell|Mary Ann)/;"

The regex here should again have \. instead of the unescaped dot.

Rajesh Amradi  May 10, 2015 
ePub Page 142
multilevel sort with hash reference algorithm

In the final example for the section "Multilevel Sort with the Schwartzian Transform", the NAME check of the sort incorrectly shows "AND" where it should have "cmp".

incorrect:
$a->{NAME} AND $b->{NAME} }

correct
$a->{NAME} cmp $b->{NAME} }

Russ Burdick  Nov 29, 2013 
Printed Page 143-144
The example used throughout "Sorting with Indices"

The list is initialised with qw() but "Mary Ann" is considered a single item in the list, when it would be two items if initialised in this way. The mistake is consistent throughout the example.

Nigel Peck  Sep 09, 2013 
Printed Page 147
first code block

second to last line has syntax error; change ] to }, so it reads:
map {ORIGINAL => $_, FOLDED => "\F$_"},

Gregory Sherman  Sep 01, 2017 
Printed Page 149, 150
combined $skipper_home and figure 10-1

There is no $skipper_bin in the final version of $skipper_home at the bottom of page 149, with the text (see Figure 10-1)

Thus, all the elements related to $skipper_bin should be removed from the "Skipper home PeGS"

Gregory Sherman  Sep 01, 2017 
ePub Page 157
Figure 11-1

The names of the modules referenced in this section don't match those in the image shown for Figure 11-1 or the description below it. The text talks about Navigation.pm and DropAnchor.pm, but the image shows navigate.pl, navigate.pm, and drop_anchor.pl.

Russ Burdick  Nov 29, 2013 
Printed Page 180
the first line in the last paragraph

"The build dist output ..."

should be

"The Build dist output ..."

Anonymous  Aug 10, 2013 
Printed Page 181
4th paragraph

page 181, Module::Starter::AddModule(v1.003) failed in Windows(Win7 64-bit, Strawberry Perl 5.16.3.1 64-bit):

In the source code of AddModule.pm:
...
system( './Build', 'manifest' );
...

would output the following message in Windows:

'.' is not recognized as an internal or external command, operable program or batch file.

But if the code had been changed to:
...
system( '.\Build', 'manifest' );
...

it's would get the message just like on page 182.

Anonymous  Jul 03, 2013 
Printed Page 181
code/text at top (apparently META.yml)

There is no "Horse.pm" created in earlier calls to module-starter (or even h2xs), so there are three lines that should not be present:
Horse:
file: lib/Horse.pm
version 0.01

Gregory Sherman  Sep 14, 2017 
Printed Page 188, 189
the first step of the module building

"--name" should be "--module"

on page 188:

%module-starter --mb --name="Animal"
should be ...
%module-starter --mb --module="Animal"

and the one on page 189 is the same:

%module-starter --builder="ExtUtils::Makemaker" --name="Animal"
should be ...
%module-starter --builder="ExtUtils::Makemaker" --module="Animal"

Anonymous  Jun 28, 2013 
Printed Page 188
first paragraph

The following text is incorrect:

we've actually "lowered" the version number because the Perl toolchain compares them as numbers (so, 1.10 is less than 1.09)

"as numbers" should be "as strings"

Gregory Sherman  Sep 14, 2017 
PDF Page 198
Mouse module code

"use Parent qw(Animal);" is not required in the code since both the methods are defined in the module.

Also, it makes the statement "We didn’t even need to initialize @Mouse::ISA to say that a Mouse was an Animal" in the next page pointless.

Rajesh Amradi  May 12, 2015 
PDF Page 199
Mouse module code

In the revisited code for Mouse.pm

"use parent qw(Animal);" is not required.
"use Animal;" will suffice.

Rajesh Amradi  May 12, 2015 
PDF Page 208
TAP example output

In the TAP output, you run three tests, 1..3. test 1 is ok, test 2 and three say "not ok", but the result is "failed 1 test of 3". That should probably have been "failed 2 tests of 3".

Uli Martens  Mar 06, 2016 
Printed Page 237
2nd paragraph

Carp provides Carp as a replacement for warn.
.......should be:
Carp provides carp as a replacement for warn.

Anonymous  Aug 20, 2013 
Printed Page 258
2nd paragraph

"..., we can add a DESTROY method to know when objects go away, purely for debugging purposes:"

Is the part " to know when objects go away" correct?

Anonymous  Oct 14, 2013 
PDF Page 313
4th line of code

The following line:

my @modules = sort keys $Module::CoreList::version{5.014002};

yields a warning, that "keys on reference is experimental". It would be cleaner to rewrite it as:

my @modules = sort keys %{ $Module::CoreList::version{5.014002} };

Grzegorz Szpetkowski  Jul 12, 2016 
PDF Page 313
2nd paragraph

The outpute of the program contains version numbers instead of dates. The correct output should look like:

AnyDBM_File 1994-10-17
App::Cpan 2009-12-20
App::Prove 2009-08-22
App::Prove::State 2009-08-22
App::Prove::State::Result 2009-08-22
App::Prove::State::Result::Test 2009-08-22

Grzegorz Szpetkowski  Jul 12, 2016 
Printed Page 333
2nd code

my $coderef = $type eq 'depth' : \&add_to_front : \&add_to_front;

should be

my $coderef = $type eq 'depth' ? \&add_to_front : \&add_to_back;

Anonymous  Jun 19, 2013 
Printed Page 340
the code of t/sum.t

is( My::List::Util::sum( 4, −9, 37, 6 ), 38,
'4−9+37+6 is six' );

should be

is( My::List::Util::sum( 4, −9, 37, 6 ), 38,
'4−9+37+6 is 38' );

Anonymous  Jul 31, 2013 
Printed Page 353
the code in Exercise 2

the following code in "sub sum_ok{ ... }" :

$label //= "The sum is $expected";

should be ...

$label ||= "The sum is $expected";


"//=" ------> "||="

Anonymous  Feb 05, 2014 
PDF, Mobi Page 603
4th paragraph

The text reads:
"First, though, here?s the true statement-based equivalent of expression at the end of
the prior section:"

It seems to be missing an article (definite or otherwise) in front of the word "expression". Perhaps:

"First, though, here?s the true statement-based equivalent of the expression at the end of
the prior section:"

Anonymous  Feb 03, 2014