mod_perl

DEVELOPER'S COOKBOOK

GEOFFREY YOUNG
PAUL LINDNER
RANDY KOBES
 Home  |  Reviews  |  Table of Contents  |  Sample Chapters  |  Source Code  |  Authors  |  Errata  |  Resources  |  Contact  Purchase Now 
  
 Errata

The below lists (unfortunate) errata contained in the first printing. With the help of our readers and the kind folks at Sams Publishing, we were able to correct the below errors in the second printing (November 2002). If you have a second printing, you can check for new errata here instead.

In cases where the errors are in the code itself, the sources in our code repository have been corrected.

You can report book errors or omissions to errata-at-modperlcookbook.org.


Page 12
Reported 04-03-2002
Reported By Mark Fowler
Description In the Debian installation instructions

# apt-get apache-perl

should be

# apt-get install apache-perl
Response thanks Mark


Page 36
Reported 03-05-2002
Reported By geoff
Description In the interests of security

Allow from All

in the Apache::Status configuration should be changed to

Allow from localhost
Allow from .example.com
Response


Page 65
Reported 05-06-2002
Reported By Stas Bekman
Description The DBI code

# Now, before using it.
$dbh->{AutoCommit} = 1;


should be changed to

# Now, before using it.
local $dbh->{AutoCommit} = 0;


to properly localize the database handle change. Pages 104 and 197 contain the same error.
Response Thanks Stas


Page 70
Reported 06-20-2002
Reported By Przemyslaw Kowalczyk
Description the line

my $sth = $dbh->prepare($query);

should be

my $sth = $dbh->prepare($sql);
Response Thanks


Page 108
Reported 05-21-2002
Reported By Lyle Brooks
Description the "idiomatic" code at the bottom of the page

$r->headers_out(Location => "pirate_map.html");

should read

$r->headers_out->set(Location => "pirate_map.html");
Response Thanks Lyle


Page 155
Reported 03-04-2002
Reported By Jeremiah Lee
Description The final lines of code from Recipe 5.1 should be

my $sth = $dbh->prepare($sql);
$sth->execute($args{term});


Response Thanks Jeremiah


Page 164
Reported 07-05-2002
Reported By Przemyslaw Kowalczyk
Description The example code for Recipe 5.4 has a few errors. The autossl_uri() subroutine should read

my $new_uri = shift;

my $r = Apache->request;

# Create a new URI based on the incoming string.
my $uri = Apache::URI->parse($r, $new_uri);


and the later handler() calls should be changed to

my $image_url = autossl_uri("http://www.example.com/sailboat.jpg");

and

my $link_url = autossl_uri("http://www.example.com/");
Response Thanks


Page 169
Reported 02-28-2002
Reported By geoff
Description The code in the Technique section of Recipe 5.7 is missing

use Apache::URI;

at the top.
Response


Page 171
Reported 02-08-2002
Reported By Tatsuhiko Miyagawa
Description In the Cookbook::SubRequestContent comments,

Apache::SubRequestContent object

should be

Cookbook::SubRequestContent.
Response Thanks Tatsuhiko


Page 206
Reported 01-18-2002
Reported By Lyle Brooks
Description Apache::Filter is really in recipe 15.4, not 15.3.
Response Thanks Lyle


Page 226
Reported 04-11-2002
Reported By Leon Brocard and Stas Bekman
Description The line

Apache::TestMM->clean;

should be changed to

Apache::TestMM->import(qw(test clean));
Response thanks guys


Page 230
Reported 02-10-2002
Reported By Tatsuhiko Miyagawa
Description For clarity, the line

plan tests => 1, have_lwp;

in Listings 7.5 and 7.6 should be

plan tests => 1, \&have_lwp;

plan() accepts either a boolean or code reference as a final argument. Additionally, plan_tests() should just be plan() in the discussion that follows.
Response Thanks Tatsuhiko


Page 238
Reported 06-07-2002
Reported By Lyle Brooks
Description The sentence

The sentence

It is also displayed by mod_status on the /server-status page.

should read

It is also displayed by mod_info on the /server-info page.
Response Thanks Lyle


Page 249
Reported 01-30-2002
Reported By Jay Lawrence
Description The return $current; at the top of the page should be removed.
Response Thanks again Jay


Page 261
Reported 03-21-2002
Reported By James G. Smith
Description mod_perl@apache.org

should be

modperl@perl.apache.org
Response This corrects an error as well as reflects the new home of the mod_perl mailing list, similar to the changes on page 611.


Page 294
Reported 05-24-2002
Reported By Andy Lester
Description the code

$r->notes(STICKY = 'note');

should be

$r->notes(STICKY => 'note');
Response Thanks Andy


Page 297
Reported 01-24-2002
Reported By geoff
Description Recipe 8.13 has a few typos.

$r->remote_ip

should be

$r->connection->remote_ip.

It's also missing a

return OK

at the end.
Response I found these when I added Cookbook::RefBlock to the code repository. go figure.


Page 300
Reported 01-24-2002
Reported By geoff
Description The Makefile.PL in Recipe 8.14 has some extraneous material in it from, well, another recipe.
Response We added complete Makefile.PL for a few recipes at the last minute where we didn't have them before. I guess this was one we copied over wrong. The code repository has been updated (and tested) accordingly.


Page 317
Reported 05-08-2002
Reported By Ernest Lergon
Description The PerlModule lines in Recipe 9.5 are reversed.
Response The correct lines should read

PerlModule Apache::Status
PerlModule B::TerseSize



Page 344
Reported 02-18-2002
Reported By Tatsuhiko Miyagawa
Description MyBreakPoint::entering_registry

in the interactive debug session should be

MyBreakPoint::enter_registry_script.
Response Thanks Tatsuhiko


Page 345
Reported 02-18-2002
Reported By Tatsuhiko Miyagawa
Description use Exporter;

is missing from the Debug package.
Response Thanks Tatsuhiko


Page 367
Reported 02-06-2002
Reported By geoff
Description the line

return $ng_rc == OK ? $rc : $ng_rc;

should be

return ($ng_rc == OK) ? $rc : $ng_rc;
Response The code works as is, but doesn't compile cleanly with perl -cw. sorry.


Page 388
Reported 02-20-2002
Reported By Randal Schwartz
Description Cookbook::Timer uses closures inconsistently - there is no need to use $r as a closure variable just to save the initial call to time().
Response Yes, that's definitely a roundabout way to do it. We will probably change the code to something like

$r->push_handlers(PerlLogHandler => sub {
  my $r = shift;

  $r->log->info("The request took ",
                time - $r->pnotes('REQUEST_START'),
                " seconds");

  return OK;
});


Page 392
Reported 04-25-2002
Reported By geoff
Description The favicon.ico handler code

  sub handler {
    my $r = shift;

    if ($r->uri =~ m!/favicon\.ico$!) {
      $r->uri("/images/favicon.ico");
      return DECLINED;
    }

    return DECLINED;
  }



can be more cleanly expressed as

  sub handler {
    my $r = shift;

    $r->uri("/images/favicon.ico")
      if $r->uri =~ m!/favicon\.ico$!;

    return DECLINED;
  }
Response


Page 401
Reported 06-10-2002
Reported By geoff
Description the line

if (-e $file) {

should be

if (-f $file) {
Response The code will work as is except for directory listings like docs/.


Page 432
Reported 06-04-2002
Reported By Joe Harnish
Description the line

my ($user, $password) = split /:/,
  decode_base64($auth_cookie{Basic}, 2);


should read

my ($user, $password) = split /:/,
  decode_base64($auth_cookie{Basic}), 2;
Response Thanks Joe


Page 535
Reported 03-22-2002
Reported By geoff
Description The initial httpd.conf line

PerlHandler Apache::SOAP

should be

PerlModule Apache::SOAP
Response


Page 541
Reported 02-20-2002
Reported By James G. Smith
Description The listings in Recipe 15.16 (15.1 and 15.2) should be 15.30 and 15.31, respectively.
Response Thanks James


Page 543
Reported 02-26-2002
Reported By Mark Fowler
Description The link for the Apache-SOAP project should be

http://xml.apache.org/soap/

instead of

http://www.apache.org/
Response Thanks Mark


Page 543
Reported 01-29-2002
Reported By geoff
Description The Java code has some repeated lines in it.

call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);

Vector params = new Vector();
params.addElement(new Parameter("server", String.class,
                                "210.50.4.19", null));
call.setParams(params);


We also meant to illustrate the code using a private IP - sorry if that causes problems.
Response Well, good thing it's not a Java book.


Page 550
Reported 03-22-2002
Reported By John C Cartwright
Description The httpd.conf line

PerlModule Apache::LogFile::Conf

should be

PerlModule Apache::LogFile::Config
Response Thanks John


Page 560
Reported 01-11-2002
Reported By geoff
Description Listing 16.1 is around the h2xs output, not DivertErrorLog.pm
Response something for the second printing, I guess :)


Page 611
Reported 03-02-2002
Reported By geoff
Description Due to recent changes

modperl@apache.org

is now

modperl@perl.apache.org
Response


Page 612
Reported 01-10-2002
Reported By Andrew Ford
Description http://refcards.com/about/mod_perl.html
http://refcards.com/about/apache.html

missing from Online Resources.
Response Oops. Sorry about forgetting the stuff from refcards.com. We've added them to the Resources page on the site.


You can report book errors or omissions to errata-at-modperlcookbook.org.