Errata from Perl for Web Site Management

Return to the book's home page

Here is a list of errors that have come to light since the book's publication. All errors that involve the book's numbered code examples have been corrected in the downloadable examples on this site. Depending on when your copy of the book was printed, these errata may have been corrected there, as well.

Pg. Example Description
xviii N/A In the third paragraph, where I list the many people in the Ishar MUD who contributed to the book, I managed to leave out Anders Wisch. My apologies.
73 N/A

About two-thirds of the way down the page, in the example of how name=value pairs can be entered in CGI.pm's offline mode, the multiword values need to be enclosed by doublequotes.

Before:

    Name=John Callender
    Address=1234 Any St.

After:

    Name="John Callender"
    Address="1234 Any St."

85 N/A

About three-fourths of the way down the page is a line that talks about updating the code in fix_links.plx. The actual script being updated is rename.plx.

Before:

That one's my personal favorite, so let's update
the code in fix_links.plx to use that version.

After:

That one's my personal favorite, so let's update
the code in rename.plx to use that version.

119 N/A

About halfway down the page is a sentence that speaks about assigning a string to $exhibit{$co_name}. The string is actually being assigned to $listing{$co_name}.

Before:

...that's the place in the &parse_exhibitor subroutine
where we assign the multiline here-document-quoted string
to $exhibit{$co_name}.

After:

...that's the place in the &parse_exhibitor subroutine
where we assign the multiline here-document-quoted string
to $listing{$co_name}.

152 N/A

About three-fourths of the way down the page is a comment about assigning an "array" to the @categories variable. Technically, the stuff being assigned should be referred to as a "list", not an "array".

Before:

Without this special behavior of split's, the array assigned
to @categories...

After:

Without this special behavior of split's, the list assigned
to @categories...

172 N/A

Four lines up from the bottom of the page, the "it" in the sentence is ambiguous (see below).

Before:

The \b makes it so that the expression can no longer
match, since it doesn't have a word boundary between Wal and nuts.

After:

The \b makes it so that the expression can no longer
match, since the string doesn't have a word boundary between 
Wal and nuts.

181 N/A

Nine lines down from the top of the page, there is a typo in the section describing the authuser log-file field.

Before:

If you are using basic 'ecHTTP authentication...

After:

If you are using basic HTTP authentication...

202 N/A

About a third of the way up from the bottom of the page, the variable having 1900 subtracted from it has been misnamed.

Before:

It also subtracts 1900 from $year.

After:

It also subtracts 1900 from $yr.

218 10-1

Example 10-1 contains a variable called $depth in its configuration section; that line shouldn't actually appear in the script until Example 10-2.

Before:

my $depth      = 20; # how deep to go in reporting top N pages

After:

(Entire line should be deleted.)

218 10-1

Example 10-1 will not compile successfully as given. This is the result of a typo in the last line of the "script-wide my variable declaration" that appears about two-thirds of the way down the page. Specifically, the $agent variable should be given as %agent.

Before:

    %last_seconds, %page_sequence, %referer, $agent);

After:

    %last_seconds, %page_sequence, %referer, %agent);

280 11-4

In certain circumstances, the link-checking script in Example 11-4 can expose a bug in the HTTP::Response module that causes the script to die. The problem can be fixed by replacing the next-to-the-last line in the check_url subroutine (which occurs just over halfway down the page) with the four lines shown below:

Before:

   my $actual = $response->base; # in case we were redirected

After:

    my $actual;
    if ($success) {
        $actual = $response->base; # redirected?
    }

281 11-4

When run on a site that uses frames, the link checker in Example 11-4 fails to process links of type "frame", and thus fails to properly spider the site. This can be corrected by modifying the following line, from the middle of page 281, just before the TARGET: label, to add '|frame' to the regular expression.

Before:

    if ($tag =~ /^(a|img)$/) {

After:

    if ($tag =~ /^(a|img|frame)$/) {

286 N/A

About two-thirds of the way down the page, a line is given from Example 11-4. This is the line that was replaced with four new lines, as described above in the errata listing for page 280. The same four lines need to be given here, with some minor wording changes in the description of what's going on.

Before:

We store the returned base URL in the $actual variable:

    my $actual = $response->base; # in case we were redirected

After:

If the page request was successful, we retrieve the base URL of the page we actually ended up on, and store it in the $actual variable:

    my $actual;
    if ($success) {
        $actual = $response->base; # redirected?
    }

288 N/A

The last line on the page gives a line from Example 11-4. It is the line that was modified in the errata listing for page 281, so the regular expression should actually look like: /^(a|img|frame)$/ (the |frame part needs to be added at the end).

318 13-1

The last line on the page gives a line from Example 13-1 that reads: close SWISH or die "can't close SWISH: $!";. That line should be deleted from the example. (It is a legacy from an earlier version of the script.)

370 16-3 Near the bottom of the page, the use vars line near the beginning of Example 16-3 fails to list the $VERSION variable. This causes the script to die with a compilation error. To correct it, $VERSION must be added to the list of variables.

Before:

        use vars       qw(@ISA @EXPORT @EXPORT_OK);

After:

        use vars       qw(@ISA @EXPORT @EXPORT_OK $VERSION);

445 N/A About a third of the way down the page, the text refers to the Make_page.pm module, saying it is the same module that was seen in an earlier chapter. In fact, the module in the earlier chapter was called Page.pm; it was given in Example 16-3. The Page.pm module being used in Example 19-3 differs in several respects from that earlier example, and those differences should have been noted in the text.

Before:

One thing you'll notice about register.cgi is that it uses the same Make_page.pm module we saw in an earlier chapter to create a simple template system. That Make_page.pm module has been placed...

After:

One thing you'll notice about register.cgi is that it uses a module called Make_page.pm to create a simple template system. That module is not shown here, but it is very similar to the Page.pm module given in Example 16-3. It differs from that earlier module in the following ways:

  • It has a different name, and hence gets a different package declaration at the top of the module. (It's called Socalsail::Make_page, as opposed to Cyberfair::Page.)
  • The subroutine that register.cgi pulls in from the module is called make_page. (The equivalent subroutine in the earlier module was called build_page.)
  • This make_page subroutine is exported by default, via the @EXPORT array. Cyberfair::Page's build_page subroutine had to be explitictly imported, since it was exported via the @EXPORT_OK array.
  • The named parameters supplied to the make_page subroutine include one called page_type. The equivalent parameter in the build_page subroutine's invocation hash was just called type.

This Make_page.pm module needs to be placed...

Return to the book's home page