Errata

CGI Programming with Perl

Errata for CGI Programming with Perl, Second Edition

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 6
Example 1-3 in the line

<P>Welcome from $remote_host! What will you find here?

"$remote_host" was changed to "$remote_id".

Anonymous    Aug 01, 2000
Printed
Page 16
Chapter title has been changed to "The Hypertext Transfer Protocol."

"Transport" was changed to "Transfer" in first sentence.

Anonymous    Jan 01, 2001
Printed
Page 17

Figure 2-1. Components of a URL; The sample URL reads:

http://www.oreilly.com:80/cgi/calender.cgi?month=july#week

It should read:

http://www.oreilly.com:80/cgi/calendar.cgi?month=july#week

Anonymous   
Printed
Page 17
1st paragraph:

Now reads "we will often..."

Anonymous    Aug 01, 2000
Printed
Page 19
1st full paragraph

Semi-colon in "%20;" was changed to an emdash.

Anonymous    Aug 01, 2000
Printed
Page 20
2nd paragraph of "URL Encoding"

In the parenthetical, "for the first eight bits" now reads "for the first
seven bits."

Anonymous    Jan 01, 2001
Printed
Page 21
last paragraph

"URI::URL" should read "URI."

Anonymous   
Printed
Page 21
url_encode() and url_decode()

The regular expressions in these two functions were missing the VERY needed /g
modifier.

In each of the code blocks, "ei" was replaced with "egi."

Anonymous    Jan 01, 2001
Printed
Page 21
url_encode and url_decode code blocks

in url_encode

$text =~ s/([^a-z0-9_.!~*'() -])/sprintf "%%%02X", ord($1)/ei;

now reads:

$text =~ s/([^a-z0-9_.!~*'()-])/sprintf "%%%02X", ord($1)/egi;

Anonymous    Jan 01, 2001
Printed
Page 21
last paragraph

"url_escape" and "url_unescape" were replaced with "uri_escape" and
"uri_unescape".

Anonymous    Jan 01, 2001
Printed
Page 27
last paragrpah

now reads:

"For this reason, we will rarely discuss to the HEAD
request method."

Strike "to" in this sentence.

Anonymous   
Printed
Page 44
5th paragraph

The paragraph reads:

CGI does not designate how web servers should handle output to STDERR, and servers
implement this in different ways, but they almost always produces a 500 Internal
Sever Error reply.

SHould say:
...ways, but they almost always produce a 500 Internal

Anonymous   
Printed
Page 50
IN PRINT: First paragraph, last sentence

"Figure 3-3 shows what the output will look in a browser window."

SHOULD BE:

"Figure 3-3 shows what the output will look like in a browser window."

Anonymous   
Printed
Page 50
1st paragraph

did read:

"The while loop iterates over %ENV with the each command to add ..."

now reads:

"The first foreach loop iterates over %ENV to add ..."

Anonymous    Aug 01, 2000
Printed
Page 54
1.5

"request" now reads "response."

Anonymous    Jan 01, 2001
Printed
Page 55
"200 OK", 3rd line

response is included in the content.

now reads

response is included in this message.

Anonymous    Jan 01, 2001
Printed
Page 60
Example 3-4, last line on the page

binmode;

was changed to

binmode STDOUT;

Anonymous    Aug 01, 2000
Printed
Page 60
end of line 6:

/^(w+)/;

now reads

/(w+)/;

Anonymous    Aug 01, 2000
Printed
Page 63
Example 3-5

binmode;

was changed to

binmode STDOUT;

Anonymous    Aug 01, 2000
Printed
Page 67
bottom half, the line

Content-Length: 67

now reads

Content-Length: 40

Anonymous    Jan 01, 2001
Printed
Page 68
2nd paragraph

Table 4-1 shows a short list of all the available form tags.

now reads

Table 4-1 shows a short list of available form tags.

Anonymous    Jan 01, 2001
Printed
Page 68
table

A new row was added after 10th row:

<INPUT TYPE="button" NAME="name" Submit button
VALUE="value">

Anonymous    Jan 01, 2001
Printed
Page 68
table, 12th row

VALUE="Message!"> now reads VALUE="value">

Anonymous    Jan 01, 2001
Printed
Page 69
ACTION, 2nd line

"the HTTP request made by the CGI script" now reads "... made by the browser"

Anonymous    Jan 01, 2001
Printed
Page 74

Figure 4-4; One of the cheese options is mispelled. It should read :

"Provolone" instead of "Provalone".

Anonymous   
Printed
Page 74
3rd-to-last line

Change

any associated JavaScript onSubmit handler,
to

any associated JavaScript onClick and onSubmit handlers,

Anonymous   
Printed
Page 78

<SELECT NAME="activity" SIZE="4" MULTIPLE>

now reads

<SELECT NAME="activity" SIZE="6" MULTIPLE>

Anonymous    Jan 01, 2001
Printed
Page 80
second sentence of "ROWS" description

The sentence now begins "Text areas ..." instead of "Text bars".

Anonymous    Jan 01, 2001
Printed
Page 81
2nd paragraph

In

"Split each name-value pair on the "s" character to
get the name and value."

the "s" was changed to "=".

Anonymous    Aug 01, 2000
Printed
Page 81
3.3

"[da-f]" was changed to "[a-f0-9]" in lines 17 and 21 in the parse_form_data
subroutine on page 81, twice in each line.

Anonymous    Jan 01, 2001
Printed
Page 82
2.1:

"and spit them" should be "and split them".

Anonymous   
Printed
Page 87
"The Kitchen Sink" header was changed to "A Swiss Army Knife" (more of an

illustrative metaphor).

Anonymous    Jan 01, 2001
Printed
Page 88
third-to-last sentence

"an alias of each of the these symbols..."

should be

"an alias of each of these symbols"

Anonymous   
Printed
Page 95
paragraph 2, line 4:

"souces" should read "sources."

Anonymous   
Printed
Page 95
paragraph 3, line 1

"Another option is to change CGI.pm's behavior ro allow access..."
should be:
"Another option is to change CGI.pm's behavior to allow access..."

Anonymous   
Printed
Page 95
The end of the first paragraph and the beginning of the second paragraph

under the "POST and the query string" section now reads:

...because CGI.pm determines what to do by checking the
request method, the data on the query string will not be
available to <EM>param</EM>. Instead, for POST requests
you must use the separate <EM>url_param</EM> method to
access any parameters passed via the query string.

Another option is to change CGI.pm's behavior to allow
access to all parameters via <EM>param</EM>. In fact,
CGI.pm includes comments to help you...

Anonymous    Aug 01, 2000
Printed
Page 96
under "Exporting Parameters," first line of first code block

"$name" now reads "$user."

Anonymous    Aug 01, 2000
Printed
Page 96
1.2

"keywords" (in "the separate keywords method") was italicized.

Anonymous    Jan 01, 2001
Printed
Page 96
2nd code block

"$" was added after ".x".

Anonymous    Jan 01, 2001
Printed
Page 98
2nd block of code

A line of code was inserted:

<INPUT TYPE="TEXT" NAME="filename">
<P><INPUT TYPE="SUBMIT">
</FORM>

Anonymous    Jan 01, 2001
Printed
Page 100
line 15 was changed to

until ( sysopen OUTPUT, UPLOAD_DIR . $filename, O_CREAT | O_RDWR | O_EXCL ) {


Anonymous    Jan 01, 2001
Printed
Page 100
The following line was added above the dir_size subroutine (after "close

OUTPUT;"):

print $q->header( "text/plain" ), "File received.";

Anonymous    Jan 01, 2001
Printed
Page 100
6th line of dir_size subroutine

The line

while ( readdir DIR ) {

now reads

foreach ( readdir DIR ) {

Anonymous    Jan 01, 2001
Printed
Page 101
IN PRINT: third paragraph, last sentence

"...you would then need periodically clean up..."

SHOULD BE:
"...you would then need to periodically clean up..."

Anonymous   
Printed
Page 108
line 10

"to a hash arguments" -> "to a hash of arguments"

Anonymous   
Printed
Page 109
2nd paragraph

The line:

print $q->start_form( method => "get", action => "/cgi/myscript.cgi");

generates the following perl code:

<FORM METHOD="method" ACTION="post" ENCTYPE="action" /cgi/mysqcript.cgi>

The line now reads:

print $q->start_form( -method => "get", -action=> "/cgi/myscript.cgi");

which will generate the correct perl code:

<FORM METHOD="post" ACTION="/cgi/mysqcript.cgi"
ENCTYPE="application/x-www-form-urlencoded">

Anonymous    Jan 01, 2001
Printed
Page 110
line 3

"array" now reads "array reference"

Anonymous    Jan 01, 2001
Printed
Page 110
3rd paragraph example

print $q->radio_group(
-name => "curtain"

now reads

print $q->radio_group(
-name => "look_behind"

Anonymous    Jan 01, 2001
Printed
Page 112-113
code examples

Line of code reading "use CGI;" HAS BEEN DELETED from both code snippets.

Anonymous    Dec 01, 2003
Printed
Page 116
code snippet

"use CGI;" was added at beginning of code.

Line 6 now begins with "print".

Line 8 now ends with a "," instead of a ";".

Anonymous    Jan 01, 2001
Printed
Page 117
block of code under "Error Subroutines", second line

now reads

my( $q, $error_message ) = @_;

Anonymous    Aug 01, 2000
Printed
Page 117
first code block

Line 6 now ends with a "," instead of a ";".

Anonymous    Jan 01, 2001
Printed
Page 119
2nd para below code, lines 3-4

"CGIBook::Exporter::error" now reads "CGIBook::Error::error"

Anonymous    Jan 01, 2001
Printed
Page 128
IN PRINT: code sample, fourth line

"...you can access it a later time..."

SHOULD BE:
"...you can access it at a later time..."

Anonymous   
Printed
Page 131
Example 6-2

use Fcntl;

now reads

use Fcntl qw( :DEFAULT :flock );

Anonymous    Aug 01, 2000
Printed
Page 134
Table 6-4, 2nd-to-last row, "Description" column

"param_name" is now set in italics (as in 3 of the other cells above).

Anonymous    Jan 01, 2001
Printed
Page 139
IN PRINT: Code sample, lines 3 and 4

<TH>Software Title</TH></TR>
<TH>Home Page</TH></TR>

NOW READS:
<TH>Software Title</TH>
<TH>Home Page</TH>

Anonymous    Dec 01, 2003
Printed
Page 144
IN PRINT: Third paragraph after Example 6-10, third sentence

"...is most relevant to with mod_perl: because..."

SHOULD BE:
"...is most relevant to use with mod_perl: because..."

Anonymous   
Printed
Page 145
IN PRINT: First paragraph, second sentence

"..."Variable scope"subsection below..."

SHOULD BE:
"..."Variable scope" subsection below..."

Anonymous   
Printed
Page 155
paragraph before example and example title

"admin_news.epl" now reads "edit_news.epl."

Anonymous    Jan 01, 2001
Printed
Page 158
Example 6-16, title

"edit_article.ep" now reads "edit_article.epl."

Anonymous    Jan 01, 2001
Printed
Page 169
half-way down

There IS NOW only one form tag and it READS:

<form method="POST" action="/cgi/register.cgi"
onSubmit="return validateForm( this )">

Anonymous    Dec 01, 2003
Printed
Page 180
line 11:

if ( document.mbrowser.artistList.selectedIndex < 0 ) {

now reads

if ( document.mbrowser.artistList.selectedIndex >= 0 ) {

Anonymous    Jan 01, 2001
Printed
Page 180
line 28


if ( document.mbrowser.concertList.selectedIndex < 0 ) {

now reads

if ( document.mbrowser.concertList.selectedIndex >= 0 ) {

Anonymous    Jan 01, 2001
Printed
Page 181
"<" CHANGED to ">=" in lines 19-26.

Anonymous    Dec 01, 2003
Printed
Page 182
halfway down and bottom

"Select a Concert" CHANGED to "Select a Recording." Also, "Concert" CHANGED to
"Recording" in last line.

Anonymous    Dec 01, 2003
Printed
Page 183
bottom of code

"song_data" CHANGED to "data".

Anonymous    Dec 01, 2003
Printed
Page 184
1st paragraph, line 5

Change "song_data" to "data".

Anonymous   
Printed
Page 184
1st code

entry with index 2 is missing

Anonymous   
Printed
Page 186
last word before header "Bookmarklets"

missing space between "WDDX" and "there"

Anonymous   
Printed
Page 188
IN PRINT: Third paragraph, second sentence

"First, we must need to make sure..."

SHOULD BE:
"First, we must make sure..."

Anonymous   
Printed
Page 188
para 6 (including codes), 2nd-to-last line

"accepts" should read "accept".

Anonymous   
Printed
Page 188
first code block on the page

open( "http://www.faqs.org/rfc/" + rfcNum + ".html" );

now reads

open( "http://www.faqs.org/rfc/rfc" + rfcNum + ".txt" );

Anonymous    Aug 01, 2000
Printed
Page 188
last code block on the page:


open('http://www.faqs.org/rfc/'+rfcNum+'.html');else if(rfcNum)

now reads

open('http://www.faqs.org/rfc/rfc'+rfcNum+'.txt');else if(rfcNum)

Anonymous    Aug 01, 2000
Printed
Page 192
1st code line

"/bookmarklets" -> "/bookmarklets/"

Anonymous   
Printed
Page 192
caption for Figure 7-5:

"comment.cgi" now reads "comments.cgi".

Anonymous    Aug 01, 2000
Printed
Page 196
2nd paragraph

The url for figlet has changed, it can now be found at -
http://www.figlet.org/

Anonymous   
Printed
Page 199
IN PRINT: "Security Strategies" section, first paragraph, last sentence

"This is a much safer way to error."

SHOULD BE:
"This is a much safer way to catch errors."

Anonymous   
Printed
Page 200
IN PRINT: 1st paragraph, 6th sentence

"Perhaps, but it always..."

SHOULD BE:
"Perhaps, but it is always ..."

Anonymous   
Printed
Page 204
line 7 of code

"feedback.cgi" NOW READS "buy.cgi"

Anonymous    Dec 01, 2003
Printed
Page 206
"SHA-1" section

Change

Digest::SHA1, which is included in Digest::MD5,

to

Digest::SHA1, which is distributed with Digest::MD5,

Anonymous   
Printed
Page 207
8th line from bottom (not including footnote)

In

"It does not matter whether the expression simple
or complex"

insert an "is" so the sentence reads

"It does not matter whether the expression is simple
or complex."

Anonymous   
Printed
Page 208
code block at the bottom of the page

/^([w+.])$/;

now reads

/^([w.]+)$/;

Anonymous    Aug 01, 2000
Printed
Page 209
code block at the top of the page:

/^([w.])$/;

now reads

/^([w.]+)$/;

Anonymous    Aug 01, 2000
Printed
Page 220
IN PRINT: Second code sample, line 13

my $subDomin = qq{ (?: [$letter$digit]
[$letter$digit-]{0,61}[$letter$digit] ) };

NOW READS:
my $subDomin = qq{ (?: [$letter$digit] |
[$letter$digit][$letter$digit-]{0,61}[$letter$digit] ) };

Anonymous    Dec 01, 2003
Printed
Page 221
end of 3rd paragraph

now reads:

"Finally, the Subject field contains a summary of
the email."

Anonymous    Aug 01, 2000
Printed
Page 224
Example 9-1

The following lines:

sub send_receipt {
my $email = shift;

now read:

sub send_receipt {
my $email = shift;
my $from_email = shift || $ENV(SERVER_ADMIN);
my $from_name = shift || "The Webmaster";

Anonymous    Aug 01, 2000
Printed
Page 224
Example 9-1, second line of send_receipt subroutine

my $from_email = shift || $ENV(SERVER_ADMIN);

NOW READS:
my $from_email = shift || $ENV{SERVER_ADMIN};

Anonymous    Dec 01, 2003
Printed
Page 230
4.4

".procmail file" CHANGED to ".procmailrc file"

Anonymous    Dec 01, 2003
Printed
Page 233
flock_test.pl

open FH2, ">> &FH1" or die "Cannot dup filehandle: $!
";

NOW READS:
open FH2, ">>&FH1" or die "Cannot dup filehandle: $!
";

Anonymous    Dec 01, 2003
Printed
Page 233
4th-to-last line

"LOCK_SH" CHANGED to "LOCK_EX"

Anonymous    Dec 01, 2003
Printed
Page 236
2nd paragraph

below 2nd paragraph,

do{ $tmp_filename = tmpnam() }
until sysopen(FH, $name, O_RDWR|O_CREAT|O_EXCL);

NOW READS:

do{ $tmp_filename = tmpnam() }
until sysopen(FH, $tmp_filename, O_RDWR|O_CREAT|O_EXCL);

and

END { unlink( $tmp_filename) or die "Couldn't unlink $name: $!" }

NOW READS:

END { unlink( $tmp_filename) or die "Couldn't unlink $tmp_filename: $!" }

Anonymous    Dec 01, 2003
Printed
Page 238
mid of page, print statements (twice)

"$q->tr" CHANGED to "$q->Tr"

Anonymous    Dec 01, 2003
Printed
Page 240
Example 10-3:

code now reads:

if ( exists $dbm_hash{$username} ) {
$email = $q->a( { href => "mailto:$dbm_hash{$username}" },
$dbm_hash{$username} );
}
else {

Anonymous    Aug 01, 2000
Printed
Page 241
in the code block


use Fcntl;

now reads

use Fcntl qw( :DEFAULT :flock );

Anonymous    Aug 01, 2000
Printed
Page 243
in the last code block

use Fcntl;

now reads

use Fcntl qw( :DEFAULT :flock );

Anonymous    Aug 01, 2000
Printed
Page 248
5.-1

Change

package repository for Win32 (refer to Appendix B).

to

package repository for Win32. Refer to Appendix B for
information on installing modules.

Anonymous   
Printed
Page 250
last paragraph:

The following sentence was added:

You may need to modify the permissions of the
<EM>address</EM> file to allow the web server to write
to it.

Anonymous    Aug 01, 2000
Printed
Page 254
line 9

"NAME="PHONE"" CHANGED to "NAME="phone"" (see page 252)

Anonymous    Dec 01, 2003
Printed
Page 265
1st code, line 1

"/index.html" CHANGED to "/catalog/9781565924192/index.html"

Anonymous    Dec 01, 2003
Printed
Page 266
3.-2

", and in the order" -> "in the order"

Anonymous   
Printed
Page 269
2.2

"access.conf" CHANGED to "httpd.conf (or access.conf, if used)"

Anonymous    Dec 01, 2003
Printed
Page 269
All instances of "query_track" and "track.cgi" HAVE BEEN CHANGED to

"query_track.cgi"

Anonymous    Sep 01, 2005
Printed
Page 283
4th paragraph

The get_items function is used by the cart function,
above, and the send_email function, below.

NOW READS:
The get_items function is used by the cart and thanks
functions, above.

Anonymous    Dec 01, 2003
Printed
Page 285
"$item_table" HAS BEEN ADDED on its own line (no semicolon) above

"END_OF_MESSAGE", at the top of the page.

NOW READS:
$item_table
END OF MESSAGE

Anonymous    Dec 01, 2003
Printed
Page 294
Example 12-1, 15th line

my $DOCUMENT_ROOT = $ENV{DOCUMENT_ROOT};

NOW READS:

my( $DOCUMENT_ROOT ) = $ENV{DOCUMENT_ROOT} =~ /^([w:/\-]+)$/
or die "Unsafe document root!";

Anonymous    Dec 01, 2003
Printed
Page 295
first paragraph


...respectively. If you do not want the program to
search the...

should be

...respectively. We have to untaint the value assigned
to $DOCUMENT_ROOT because we obtain it from an environment
variable. If you do not want the program to search the...

Anonymous   
Printed
Page 295
Example 12-1, near the top of the page:

if ( defined $query ) {

now reads

unless ( defined $query ) {

Anonymous    Aug 01, 2000
Printed
Page 297
Example 12-2, line 9 of code

"if" should be changed to "unless".

Anonymous   
Printed
Page 298
Example 12-2, near the top of the page:

foreach ( @files ) {

now reads

my $file;
foreach $file ( @files ) {

Anonymous    Aug 01, 2000
Printed
Page 298
later in Example 12-2

foreach $full_path ( @sorted_paths ) {

now reads

my $full_path;
foreach $full_path ( @sorted_paths ) {

Anonymous    Aug 01, 2000
Printed
Page 298
line 3

"close DIR;" CHANGED to "closedir DIR;"

Anonymous    Dec 01, 2003
Printed
Page 298
s|$query|<B>$query</B>|gio

NOW READS:

s|($query)|<B>$1</B>|gio;

Anonymous    Dec 01, 2003
Printed
Page 298
The fifth and sixth lines NOW READ


foreach my $file ( @files ) {
my $full_path = "$DOCUMENT_ROOT/$file";

Anonymous    Dec 01, 2003
Printed
Page 298
halfway down the page

foreach $full_path ( @sorted_paths ) {

NOW READS:
foreach my $full_path ( @sorted_paths ) {

Anonymous    Dec 01, 2003
Printed
Page 298
After "$text =~ s/>/&gt;/g;" the following line HAS BEEN ADDED

return $text;

Anonymous    Dec 01, 2003
Printed
Page 299
6th paragraph

"$file" should be replaced by "$fullpath".

Anonymous   
Printed
Page 300
In the last prose paragraph on the page

"Here is the beginning of the new search script:"

now reads

"Here are the changes to our previous search script:"

The code block that follows now reads:

.
.

my $q = new CGI;
my $regex ...

Anonymous    Aug 01, 2000
Printed
Page 301
code at bottom of page

now reads

#!/usr/bin/perl -w
# This is not a CGI, so taint mode not required

use strict;

use File::Find;
use Fcntl;
use DB_File;
use Getopt::Long;
use Text::English;

Anonymous    Aug 01, 2000
Printed
Page 302
lower half, 5th line of subroutine load_stopwords

"Cannot file" should read "Cannot find."

Anonymous   
Printed
Page 302
Example 12-3

In the following line:

$DB_BTREE->{cachesize} = $cache || DB_CACHE;

"$cache" was changed to "$opts{cache}".

Anonymous    Aug 01, 2000
Printed
Page 302
Example 12-3

In

tie %index, "DB_File", $opts{'index'}, O_RDWR|O_CREAT, 0640, $DB_TREE

"0640" now reads "0644".

Anonymous    Aug 01, 2000
Printed
Page 302
on the last line of Example 12-3

local *FILE, $_;

now reads

local( *FILE, $_ );

Anonymous    Aug 01, 2000
Printed
Page 302
1/3 way down listing

The lines

$index{"!OPTION:stem"} = 1 if $opts{'stem'};
$index{"!OPTION:ignore"} = 1 if $opts{'ignore'};

HAVE MOVED to appear after

tie %index, "DB_File", $opts{'index'}, O_RDWR|O_CREAT, 0644
or die "Cannot tie database: $!
";

not before.

Anonymous    Sep 01, 2005
Printed
Page 303
Example 12-3:

In the line

s/<.+?>//gs; # Woa! what about < or > in comments or js??

the comment was changed to

# Note this doesn't handle < or > in comments or js

Anonymous    Aug 01, 2000
Printed
Page 303
middle

( $word ) = stem( $word ) if $opts{stem};

now reads

( $word ) = Text::English::stem( $word ) if $opts{stem};

Anonymous    Aug 01, 2000
Printed
Page 303
line 17 in the code

s/<.+?>//gs;

NOW READS:
s/<(?:[^>'"]*|(['"]).*?1)*>//gs;

Anonymous    Sep 01, 2005
Printed
Page 304
1st para

Everything after 1st sentence HAS BEEN DELETED in this paragraph.

Anonymous    Sep 01, 2005
Printed
Page 304
2nd para

"stem.pl, a Perl 4 library," NOW READS "Text::English"

Anonymous    Sep 01, 2005
Printed
Page 305-306
order of sentences and names of the arguments need to be changed

according to code in Example 12-3 (see end of page 302).

Change

$stop is a reference to a hashes [sic] containing our
stop words. The final argument, $args, is simply a reference
to the hash of our command-line arguments.

to

$opts is a reference to the hash of our command-line arguments.
The final argument, $stop_words, is a reference to a hash
containing our stop words.

Anonymous   
Printed
Page 305
top

"$ ./Indexer ..." now reads "$ perl indexer.pl -dir ..."

Anonymous    Aug 01, 2000
Printed
Page 305
2nd line after code

"$conf{index}" CHANGED to "$opts{index}" (as used in Example 12-3)

Anonymous    Dec 01, 2003
Printed
Page 306
first line

"hashes" should be "hash".

Anonymous   
Printed
Page 306
4.1

Change

...storing the key in $file_id and the value of the current
file in $file.

to

...storing the path of the current file in $file.

Anonymous   
Printed
Page 306
7th paragraph

Change

We also strip all HTML tags from the paragraph, since
we don't want them to be indexed. The regexp will look
for a string starting with "<", followed by one or more
characters (including newlines) until it finds the first
">".

to

We also strip all HTML tags from the paragraph. This simple
regexp does a pretty good job of removing tags, but note
that it might have problems with some HTML comments or
JavaScript code. For a more thorough approach, refer to the
perlfaq9 man page.

Anonymous   
Printed
Page 306
7.2

"<" -- Change the closing double quote to an opening quote.

Anonymous   
Printed
Page 306
last line

The second occurence of the word "number" should be replaced by "word".

Anonymous   
Printed
Page 306
2nd-to-last paragraph

NOW READS:
If the <EM>-stem</EM> option is specified, we call
the Text::English module's <EM>stem</EM> function
to remove all suffixes from the word and covert it
to lowercase. Text::English is distributed as a
component of the perlindex module.

Anonymous    Sep 01, 2005
Printed
Page 307
Example 12-4

NOW READS:
#!/usr/bin/perl -wT

use strict;

use Fcntl;
use DB_File;
use CGI;
use CGIBook::Error;
use File::Basename;
use Text::English;

use constant ...

Anonymous    Sep 01, 2005
Printed
Page 308

if ( $do_stemming ) {
my( $stem ) = stem( $word );

now reads

if ( $do_stemming ) {
my( $stem ) = Text::English::stem( $word );

Anonymous    Aug 01, 2000
Printed
Page 308
line 13

The following line of code HAS BEEN DELETED:

my $file = basename( $path );

Anonymous    Dec 01, 2003
Printed
Page 314
Example 13-1, near the bottom of the page

local *DIR, $_;

now reads

local( *DIR, $_ );

Anonymous    Aug 01, 2000
Printed
Page 315
algorithm code line

">" -> "<"

Anonymous   
Printed
Page 317
6th-to-last line

"Perl port of" -> "Perl interface to"

Anonymous   
Printed
Page 321
2nd paragraph, 1st line

"UPPER_LIMIT" CHANGED to "LOAD_MAX".

Anonymous    Dec 01, 2003
Printed
Page 322

5th paragraph; The first sentence reads:

"GD::Text is collection of modules..."

It should read:

"GD::Text is a collection of modules..."

Anonymous   
Printed
Page 323
in the middle of page, 3rd line after code

"We should then remove the TITLE_X_COORD constant, which we know longer
use..." should be "which we no longer use."

Anonymous   
Printed
Page 333
Example 13-5

The following line of code HAS BEEN DELETED:

[ 17, 15, 19, 15, 24 ],

Anonymous    Dec 01, 2003
Printed
Page 334
Example 13-5

The following line of code HAS BEEN DELETED:

seek TMPFILE, 0, 0;

Anonymous    Dec 01, 2003
Printed
Page 337
2.-1

"path to ImageMagick" CHANGED to "path to Image::Magick"

Anonymous    Dec 01, 2003
Printed
Page 350
first line

<FORM METHOD="POST">

NOW READS:
<FORM METHOD="POST" ACTION="/cgi/whats_related.cgi">

Anonymous    Sep 01, 2005
Printed
Page 350
first statement in Example 14-5

print $q->redirect( "/quiz.html" );

NOW READS:
print $q->redirect( "/whats_related.html" );

Anonymous    Sep 01, 2005
Printed
Page 350
line 28

$q->h1( "What's Related To What's Related Query" );

NOW READS:
$q->h1( "What's Related To What's Related to $url" );

Anonymous    Sep 01, 2005
Printed
Page 351
first line

print $q->a( { -href => "$scriptname?url=$_->[0]" }, "[*]" ),

NOW READS:
my $esc_url = $q->escape( $_->[0] );
print $q->a( { -href => "$scriptname?url=$esc_url" }, "[*]" ), " ",

Anonymous    Sep 01, 2005
Printed
Page 351
lines 8-11

foreach ( @subrelated ) {
print $q->a( { -href => "$scriptname?url=$_->[0]" }, "[*]" ),
$q->a( { -href => "$_->[0]" }, $_->[1] )
}

NOW READ:
foreach ( @subrelated ) {
$esc_url = $q->escape( $_->[0] );
print $q->li(
$q->a( { -href => "$scriptname?url=$esc_url" }, "[*]" ),
$q->a( { -href => "$_->[0]" }, $_->[1] )
);
}

Anonymous    Sep 01, 2005
Printed
Page 351
halfway down

$q->text_field( -name => "url", -size => 30 ),

NOW READS:
$q->textfield( -name => "url", -size => 30 ),

Anonymous    Sep 01, 2005
Printed
Page 352
first line

while ( $data =~ s|(="[^"]*)"([^/ ])|$1'$2|g ) { };

NOW READS:
while ( $data =~ s|(="[^"]*)"([^>?/ ])|$1'$2|g ) { };
while ( $data =~ s/(<([^>"=]|="[^"]*")*)=(w+)/$1="$2"/ ) { };

Anonymous    Sep 01, 2005
Printed
Page 352
2nd line below code

"@RELATED_RECORDS" NOW READS "$RELATED_RECORDS"

Anonymous    Sep 01, 2005
Printed
Page 356
1st line

"the handle_start subroutine was passed" -> "a reference to the handle_start
subroutine was passed"

Anonymous   
Printed
Page 356
3.2

"the $href tag" NOW READS "the $href variable"

Anonymous    Sep 01, 2005
Printed
Page 358
2nd paragraph

"create" should be replaced by "creates".

Anonymous   
Printed
Page 359
4th paragraph (1st paragraph in section "Line Endings")

There is a "was" missing between "that" and "downloaded" in the first sentence.

Anonymous   
Printed
Page 359
5th paragraph (1st paragraph of section "Malformed Header")

"Transport" should be replaced by "Transfer".

Anonymous   
Printed
Page 359
3rd line from bottom of the page

"... to return all necessary HTML headers..."

"HTML headers" should be replaced by "HTTP headers".

Anonymous   
Printed
Page 361
two code snippets in middle of page

$id = 2000;
$field = $id;

NOW READ:
my $id = 2000;
my $field = $id;

Anonymous    Sep 01, 2005
Printed
Page 367
3rd paragraph (1st paragraph of section "Check syntax")

"add" in the fourth line should read "at".

Anonymous   
Printed
Page 369
line below header "Dumping Variables"

"If you script" -> "If your script"

Anonymous   
Printed
Page 372
1st code

A space after #! HAS BEEN DELETED and path HAS BEEN REFORMATTED as regular font.

Anonymous    Sep 01, 2005
Printed
Page 376
3rd code, lines 1-2

end of line 1: "conf" NOW READS "data"
end of line 2: "data" NOW READS "conf"

Anonymous    Sep 01, 2005
Printed
Page 377
4th paragraph

There is a space missing between "display" and "associated" in the first line.

Anonymous   
Printed
Page 383
lines 1-2:

"loops" -> "loop" (of a ... loop)
"conditionals" -> "conditional"

Anonymous   
Printed
Page 383
first line after code

"manges" -> "manages"

Anonymous   
Printed
Page 386
item #6:

now reads

Clear arrays with <CW>()</CW> instead of <EM>undef</EM>.

Anonymous    Aug 01, 2000
Printed
Page 388
last paragraph

"advantageous" should be replaced by "advantages".

Anonymous   
Printed
Page 389
"Avoid Slurping", 2nd code

"print $q->tr" NOW READS "print $q->Tr".

Anonymous    Sep 01, 2005
Printed
Page 392
4th paragraph, 1st sentence

It as also much safer...

should read:

It is also much safer...

Anonymous   
Printed
Page 393
middle of page

Change

news:comp.lang.perl and news:comp.lang.perl.misc are
more general newsgroups.

to

news:comp.lang.perl.misc is a more general newsgroup.

Anonymous   
Printed
Page 394
2nd code block

while (<FILE>) {
next if (/^select/);
next if (/^update/);
...
}

NOW READS:

while (<FILE>) {
next if (/^select/);
next if (/^update/);
...
}

Anonymous    Sep 01, 2005
Printed
Page 394
5th line of third code block

$code .= "next if (/^$keyword/);
";

NOW READS:
$code .= "next if (/^$keyword/);
";

Anonymous    Sep 01, 2005
Printed
Page 395
5th paragraph (the single line above the source code)

This line should read:

Example 17-1 shows what a typical FastCGI script looks like.

INDEX:

Anonymous   
Printed
Page 396
caption for Example 17-2:

"fast_count.cgi" now reads "fast_count2.cgi".

Anonymous    Aug 01, 2000
Printed
Page 404
Appendix A, "Additional Reading" section

This section listed the first edition of Jon Bentley's book Programming Pearls.
This reference HAS BEEN CHANGED to the current edition:

Bentley, Jon. Programming Pearls, Second Edition. ACM Press and
Addison-Wesley, 1999.

Anonymous    Sep 01, 2005
Printed
Page 416
clients

"semi-automonous" -> "semi-autonomous"

Anonymous   
Printed
Page 417
cookie_test.cgi

"scrip" -> "script"

Anonymous   
Printed
Page 417
entry "CPAN", last subentry

"URI::URL" should read "URI".

Anonymous   
Printed
Page 422
entry "escaping", last subentry

"url_escape" should read "uri_escape" and "url_unescape" should read
"uri_unescape".

Anonymous   
Printed
Page 423
"files" entry, "specifying for search subentry

"protocols" should be the subheading for "HTTP (see HTTP)", "fgrep command"
and "specifying for search" should be dropped.

Anonymous   
Printed
Page 428
<IMG> tag

One "using with" is redundant.

Anonymous   
Printed
Page 432
entry "modules"

subentry "URI::URL" should read "URI".

Anonymous   
Printed
Page 435
parsers, XML

Merge "XML::Parser" and "XML::Parser module" entries.

Anonymous   
Printed
Page 436
"peformance" -> "performance" (which results in moving the subentries to

"performance ...")

Anonymous   
Printed
Page 438
"programming languages, code file extensions" should be listed under

"languages:file extensions" (page 430).

Anonymous   
Printed
Page 440-441

merge entries "regex", "regexp" and "regular expressions".

Anonymous   
Printed
Page 443
Remove "Set-cookie header" and add page 36 to "Set-Cookie header".

Anonymous   
Printed
Page 445
entry "subroutines", last subentry

"URI::URL" should read "URI".

Anonymous   
Printed
Page 445
Remove entry for "stem.pl program".

Anonymous   
Printed
Page 448
"URI::URL module" should be deleted and "URI module" should include page

21.

Anonymous   
Printed
Page 448
entry "url_escape and ..."

"url_escape" should read "uri_escape" and "url_unescape" should read
"uri_unescape".

Anonymous   
Printed
Page 448
entry "URLs (...)", subentry "encoding ..."

"URI::URL" should read "URI".

Anonymous   
Printed
Page 450
web servers

"cgi-bin diretory" -> "cgi-bin directory"

Anonymous