- ISBN13: 978-1-4302-2365-8
- ISBN10: 1-4302-2365-0
- 362 pp.
- Published Jul 2009
- Print Book Price: $49.99
- eBook Price: $34.99
Errata Submission
If you think that you've found an error in The Definitive Guide to Catalyst: Writing Extensible, Scalable and Maintainable Perl–Based Web Applications, please let us know about it. You will find any confirmed erratum below, so you can check if your concern has already been addressed.
Errata
| Issue | Author's Response |
|---|---|
| chapter 6, page 159 provided createroles.pl script, use FindBin qw($Bin); use lib '$Bin/../lib'; use Auth::Schema; use lib line has single quotes, no variable interpolation. Therefore $Bin doesn't get interpolated :) also I had to change "Roles" to "Role" to get it to work. cheers |
You're correct about the interpolation. The singularisation of table names has been caused by the new version (0.05 I think) of DBIx::Class::Schema::Loader, so this is also correct. |
| On page 88 in the 'A Driver Model for Generic Tranalation', you say : 'If we open up LolCatalyst/lite/Translator.pm and change the package line to LolCatalyst::Lite::Translator::LOLCAT', ... we can go on to add code defining the new, driver-using LolCatalyst::Lite::Translator class at the top.' You say "change the package line" but seem to be adding a package - i.e. 2 classes in one file. I have to read on a few pages to try and find out what you are doing to this file. Without knowing, and not seeing the whole file, it is very unclear what you are doing and what the file should contain. Thanks, Alastair |
I agree this maybe could be clearer. The downloadable source code does show the correct code for this section however, and as it is stored in a git repository, it is possible to look at the development process that leads to the change in the code |
| Chapter 5, Page 111: $ CATALYST_ENGINE=HTTP:Prefork..... should be $ CATALYST_ENGINE=HTTP::Prefork... There's a missing colon. Thanx, Dp. |
Thanks |
| Chapter 10, page 239 Your use of around is wrong. It needs to be: around execute => sub { my $orig = shift; my $self = shift; ... return $self->$orig(@_); }; next::method is not only going to be slower, but the fact that you didn't shift off $orig breaks the code entirely. |
Thanks, noted. |
| Chapter 2 page 21 Fedor and Red Hat. The trailing "'" is missing for Scalar::Util test. perl -MScalar::Util=weaken -e 'weaken \1 & warn "Your perl is OK\n" should be: perl -MScalar::Util=weaken -e 'weaken \1 & warn "Your perl is OK\n" ' |
Thanks |
| Ch. 3, p. 63 In a middle paragraph, just after the 'END' block, the text of '[% content %]' should appear in code font. Also, the explanatory/directive part two paragraphs above the WRAPPER block is a little unclear about directing what to do. I would change: "just after the <body> tag: [% content %]" to: "and so insert: [% content %] just after the <body> tag." |
Thanks |
| Ch. 3, p. 57 Three lines from the bottom in "The auto_install directive", 'directive' should not be in code font. | thanks |
| Chapter 11, Page 263, about the 7th line from the bottom: code doesn't work (for me) with %chart_data reads: my %chart_data = $c->model('Chart')->make_chart; It works when changed to: my $cc = $c->model('Chart')->make_chart; Awesome book - thanks |
Thanks |
| Ch 5, p. 121, second paragraph. Refers to a prior reference to HTTP::Prefork, but there's no page number nor is there an entry for HTTP::Prefork in the index. No way to easily find it. This is the section on configuring fastcgi w/ lighttpd, an important reference. |
Thanks |
| Chapter 8, Page 199, 8th line from the top: Reads: "...you can tell the Password credential to do so by using setting password_type to 'hashed'... It appears that the word "using" is these in error. |
Thanks |
| Chapter 3, page 70. The first instance of 'my $response = request($request)' should be 'my $response = undef' to be consistent with the rest of the code. | Disagree, the subsequent $response=undef lines reset the value of the variable. We can skip making the variable undef on declaration without impairing the clarity of the code. |
| Chapter 11, page 299. "alias catsdd" is missing the final "-d" and should be: "alias catsddd='CATALYST_DEBUG=1 perl -d script/*server.pl -d'" Also: using "perl script/*server.pl" rather that running the bare script will ensure that the scripts work, in those cases that the script's shebang line points to an invalid perl path. |
thanks |
| Chapter 4, page 85. Twice you have "perl -Ilib lib/LolCatalyst/Lite/Translator.pm" but at this early stage the extra -Ilib is technically not needed yet. Only later with the addition of "use aliased 'LolCatalyst::Lite::Interface::TranslationDriver'" is it required. However, it's probably a good idea anyway to always use -Ilib as good practice. | This is probably too much information, but you are right. |
| page 122, chapter 5 Typo in the title of the warning box: 'deployemnt' should be 'deployment'. |
thanks |
| typo p 77: sqlite> exit needs a leading dot: sqlite> .exit |
Thanks |
| p 64: By replacing the error page with ('internal server error'), you mask debugging information that your reader might well need to get these exercises to work. You might want a sentence that says "if things don't work and you need to debug a problem, disable this in this way..." (or some appropriate solution). --A struggling beginner |
Perhaps this could be clearer for the second edition. |
| Chapter 7, page 186, text: "Here’s the code to go in DwarfChains::Controller::Info:" Should be "Here’s the code to go in DwarfChains::Controller::People::Info: Thanks |
Thanks. |
| Chapter 6, page 158. The user is asked to set up the authentication plugin 'as was described in chapter 3'. It may be useful to suggest a location for the $c->authenticate call, putting it in edit seems to cause end endless loop of calls. Not sure if that description was going to be included or it's up to the user to figure out where to add authentication, but the chapter as written assumes it is working (the Update A User callout just says 'Restart your app.' but no where specifies the location for the authenticate call. Thanks! Tom |
The location should be the same as it was in chapter 3, i.e. in sub translate_service : Local { |
| Page 153: text "and we remove the original VALIDATE THE DATA section in DBICTest::Controller::AuthUsers." There are a few problems with this line. 1: DBICTest should be DBAuthTest? 2: What is the VALIDATE THE DATA section? In my code no data validation had been done in AuthUsers yet. Thanks! |
The VALIDATE THE DATA section is in a code comment immediately above the code. We should really have marked this as "the code section commented", not implied that it was a chapter section. |
| Page 151: The example code starting on this page are placing the : in a location not consistent with previous example code. For example: sub add : Chained('base'): PathPart('add'): Args(0) { For users like me new to Catalyst, the change is a bit confusing. Also, the tip on page 150, regarding DBIC_TRACE=1 was a little confusing because at that point in the chapter it could not be run (the authusers handler had not been set up yet). Thanks, Tom |
Thanks. All ":" characters after the first one are optional. |
| Page 146 The line: script/dbauthtest_create.pl model AuthDB DBIC::Schema Auth::Schema \ create=static components=TimeStamp dbi:SQLite:auth.db I think the connect string should be like the previous: dbi:SQLite:db/auth.db ? Thanks! Tom |
Thanks |
| Page 146 we have an alter statement to add last_modified: sqlite3 db/auth.db "ALTER TABLE users ADD COLUMN last_modified DATETIME" When this column is created, on my version of sqlite at least (3.6.18) the columns is nullable. The text then states: We should now see that a new column has appeared in the Auth::Schema::Result::Users class: "last_modified", { data_type => "DATETIME", is_nullable => 0, size => undef }, But in my Users.pm is_nullable is 1 (which matches what you'd expect from the alter statement). Thanks! |
Thanks for identifying this subtle potential problem. |
| page 91: "so we rename it to _translators, update the calls to it to use the new name, and rename the builder method to _build__translators," I believe at this point there is only one call to translators (in translate_to), if so, the text should read 'update the call to it' otherwise people are hunting for the missing call. Thanks! Tom |
Thanks. |
| In all the cases where we are asked to run make test again, but we don't set up the APP_TEST variable, which in my current state makes tests fail. Running APP_TEST make test does work. I may have missed a step, but if not, it may be something you want to address at this point (if you do so later). |
The test is supposed to fail before setting the APP_TEST variable. |
| p 89 Editing the Makefile.pl you say to remove the line to Acme::Bleach, but that line is actually Acme::LOLCAT. | Thanks. |
| Page 86, Chapter 4 uses Catalyst::Model::Adaptor but that module hasn't been installed already by the earlier instructions. It may be something to mention. Thanks. |
Thanks. Perhaps we should have explicitly explained to install this through cpan. We will consider giving more explicit cpan installation instructions should the book reach a second edition. |
| Feedback: There was a comment by someone "An example of basic authentication is provided in chapter 3. Using the latest installation of Catalyst, this now seems deprecated, resulting in "Not a GLOB reference" in Config::General.pm:547 (version 2.43, July 19th 2009)." The solution on my system was to use cpan to update Config::General. |
Thanks |
| Chapter 11, pages 283-288 The config constructor for the Authentication plugin uses 'user_class' without any specific introduction to that option. Catalyst::Authentication::Store::DBIx::Class docs state that 'user_class' is deprecated in favor of 'user_model'. If that is correct, Instances of user_class should be replaced with user_model in that page range. If instead they have different semantic meanings, an explanation of that option is warranted. |
You are correct. The user_class config key was changed to user_model to avoid confusion with the 'class' key. Apart from the name change, they function identically. |
| Chapter 7, p. 170, last code example at bottom of page. This code as it stands actually produces: "http://localhost:3000/pet/doit/pet/labradoodle" (admittedly could only test on Catalyst 5.7015). Not sure what was intended so can't offer a correction. |
$c->req->args should contain a single item arrayref containing labradoodle, not $c->req->path |
| Chapter 7 - The Catalyst Dispatcher, page 181. 3rd paragaph. Swap go/visit. Sentences starting with "If we use go" and "If we use visit" should swap go and visit. |
Thanks |
| Page 27 - inaccurate description of ASCII and UTF-8 The text says, "NOTE: A byte is the length of a single ASCII character. A UTF-8 glyph, the most common encoding of non-European characters, can be 1 and 3 bytes long." A few notes: 1. ASCII is a 7-bit standard; the characters 128-255 aren't defined in ASCII (although they are defined in other encodings such as ISO-8869-1 Latin 1). So, technically, a byte is actually one bit longer than a single ASCII character. 2. In UTF-8, a character can be encoded as 1, 2, 3, or 4 bytes (not 1-3). 3. The wording "UTF-8 glyph" confuses characters and glyphs. A glyph is the physical realization of an abstract character (think blob of ink on the page). 'e' in Times 10 point and 'e' in Garamond 16 point italic are two glyphs which realize the abstract character 'e'. Also, the encoding of a character is technically not the same thing as the abstract character itself ('e' is 'e', even if ASCII and, say, EBCDIC encode it differently). Suggested wording: The UTF-8 encoding of a character takes 1, 2, 3, or 4 bytes. |
Thanks |
| Chapter 4 - Page 97 - typo; an HTTP permanent redirect is code 301, you said 302. | Catalyst sends a 302 with $c->res->redirect. If you want to send a 301 redirect you'll have to override $c->res->redirect yourself or write a new sub (e.g. MyApp->permanent_redirect) where you manage all the headers yourself. |
| Chapter 2, Page 42, The sentence BUILD and BUILDARGS are documented with examples in Moose::Cookbook::Basics::Recipe11. should read BUILD and BUILDARGS are documented with examples in Moose::Cookbook::Basics::Recipe10. |
Thanks |
| Chapter 3, Page 72 - perl debugger example may not work. The instructions for setting a breakpoint manually in the debugger may not work reliably - on some systems, the breakpoint may be ignored. Using $DB::single (as noted on Page 73) to set breakpoints worked. |
Thanks |
| Chapter 3, Page 63 - index.tt did not work as expected. Using the example templates, I found that the content from index.tt was rendered below the contents of page.tt (not inserted at the content tag). To correct this, I had to put the TT '[% END %]' tag at the bottom of the file (and remove '; END' from the first line) |
Thanks |
| Chapter 3, Page 60 - the example code to add a Last-Modified header does not work correctly. In the example, localtime() gets called in an array context. Changing it to "scalar localtime()" yields the desired behaviour. |
Thanks |
| Page 236 - sub end :ActionClass('RenderView) { } is missing a single quote. |
Thanks |
| Page 145 The code at the top of the page shows that Auth::Schema::Result::UserRoles makes a "belongs_to" relationshipo named "role" while my catalyst installation created one called "role_id" which is more in line with what is written on page 144 where the belogns_to relationship is called "user_id" (not "user"). Note that if you update the name of the belongs to relationsihp to role_id (to match what catalyst is generating) then you should also modify the rest of the text in the "Relationship bridges" section on the same page and the reference to $user->roles on page 161. If you did indeed mean to name the relationship "role" instead of "role_id" then you may want to note that the code you are using is different then what catalyst generates and the reader should change the name of the role. |
This was caused by updates to DBIx::Class or DBIx::Class::Schema::Loader while the book was being rewritten. Apologies |
| On page 43, second sentence under the heading Custom Type Constraints incorrectly shows: has => 'URI' instead of has => 'Str' which should be: isa => 'URI' instead of isa => 'Str' |
Thanks |
| There errors on Page 36. I the first bit of new code, in defining the 'has guest_greeting' attribute, the default declaration is incorrect. It should be: default => 'Hello __NAME__, I don\'t know you, do I?' The \' is missing in the book. Alternatively, use double quotes to surround the string. Second error is in the documentation code. A comma is missing after the line: guests => [qw( Homer Bart Marge Maggie) ] Finally, a minor nitpick in the last paragraph is the word 'quest' appears instead of 'guest' at the end of the 5th sentence. |
Thanks |
| Chapter 4, page 86 The part where you ask the reader to rename the filename Translate.pm to Translator.pm You might want to add that after the rename, the package will have to be changed from LolCatalyst::Lite::Model::Translate to LolCatalyst::Lite::Model::Translator. |
Thanks |
| Page No: 131. .; in the first line of text after the camel should be either a . or a ; | Thanks |
| The LOLCat application example is 'cross site scripting' vulnerable except for only reading POST parameters (which only helps a bit anyway). Being the first example, it really should be escaping the output properly. |
Will investigate and note for future editions |
| Page 42-43: The example uses 'use namespace::clean'; but the next page talks about "Note the use of 'namespace::autoclean' ...". | Thanks |
| page 57: Makefile.PL (as created by catalyst.pl LolCatalyst::Lite) is a bit different : ... use inc::Module::Install; name 'LolCatalyst-Lite'; all_from 'lib/LolCatalyst/Lite.pm'; |
There is a minor difference, but doesn't impact on the functionality of the program. |
| Chart on page 168, Chapter 7, decision box "Did Auto Return 0?" has two "No" paths and no "Yes" path. The "No" on the right side should be "Yes". On page 131, Chapter 5, section "make installdeps", there are two places in which "Makefile.PL" is used that should be "Makefile". "no pollution to your distribution directory except for the addition of the Makefile.PL after you run Perl Makefile.PL" should read "no pollution to your distribution directory except for the addition of the Makefile after you run Makefile.PL." On the next page (132), "Once you've run make installdeps, run make realclean to remove the generated Makefile.PL." should read "Once you've run make installdeps, run make realclean to remove the generated Makefile." In the acknowledgments on paage xxiii, "Eden Caram" should be "Eden Cardim", and 'Robert "Phaylon" Seladek' should be 'Robert "Phaylon" Sedlacek'. |
Some of these are duplicates, but the p131 report is not |
| An example of basic authentication is provided in chapter 3. Using the latest installation of Catalyst, this now seems deprecated, resulting in "Not a GLOB reference" in Config::General.pm:547 (version 2.43, July 19th 2009). | Seemed to work fine on my system the other day. Perhaps one of your dependent modules is out of date. |
| page 168 flow chart Did Auto return 0 options are No and No instead of Yes and No |
The "Yes" branch should be the one on the right hand side. |
| chapter 3/ pager 63 this command perl -MCGI=:standard -e 'print start_html("[% title %]"),end_html;' > page.tt doesn't seem to work on windows unless modified to be written as perl -MCGI=:standard -e "print start_html(\"[% title %]\"),end_html;" > page.tt |
Thanks |
| Chapter 6, page 152, First Note section says "variation" should be "verification" | Thanks |
| Chapter 6, page 144, the belongs_to example lists the first argument as "user_id" but underneath describes the arg as "user". | Looks like it should be 'user' in the code. |
| Chapter 6, page 143, top of page, "support" should be "supported" | Thanks |
| Chapter 4, page 101. In "Back to the test cycle," the line to set the authorization for the request is missing! before the first ok statement, there should be a line: $request->headers->authorization_basic('fred','wilma'); |
A section of text in this chapter asking the user to start with the state of the code from page 73 (i.e. just before auth was added) was inadvertently removed from the introduction of the chapter. |
| Ch 6 Pgs 158 & 159 Code: [% IF c.user.object.id == user.id; PROCESS components/edit_user.tt; END; %] More an issue of clarity I suppose, but there is a substantial amount of additional code required to support the checking of the current user. Unless I'm missing something, we would have to login to our application in order to make this work. |
There's no actual error here, but perhaps the order of presentation of code and template could be reversed. |
| Chap. 6, P. 137, bottom section: mkidr ... should be mkdir |
Thanks |
| The word 'terminal' on page 42 should not be in code font | Thanks |
| Printed copy, Ch. 6, p 144, mid-way down page at definition of has_many relationship: the relationship name should be 'user' not 'user_id' | Not completely sure about this one. I'd say to try the suggestion in the erratum if what's in the book causes you trouble. |
| Chapter 3, page 59. Second paragraph, first sentence. See Appendix C. However, my book does not have an Appendix C. | Thanks. This should be "See the 'Making the most of CPAN' section in chapter 2, especially 'Testing CPAN modules' subsection. |
| Page 29 (in chapter 2) makes brief mention of the "Squirrel" module. Squirrel has been deprecated by its author in favor of Any::Moose. Impact on the book is very slight, though, since Squirrel isn't used anywhere else. | Thanks, this is an example of the book going out of date quickly. |
| Chapter 3, page 57. Last line at the bottom of the page. Should read 'and WriteAll is the instruction to proceed with writing Makefile and some ...' NOT 'Makefile.PL' | Thanks |
| Chapter 3, page 57. In code sample, should be: name 'LolCatalyst'; # first apostrophe is missing. |
Thanks |
| Chapter 2, page 51. About half way down the page, the line after 'We can run the failing test file ...' mangled start of sentence should be: $ perl -Ilib t/27_FillInForm.t | Thanks |
| Chapter 2, page 36. Second to last line at the bottom of the page. Should be Third, we provide ... for the guests attribute (guest := guests). | Thanks |
| Chapter 2, page 20. A Note on Perl 5.10.0 - Would be helpful if you tell which version of Perl is alright and/or which patch and how to install. | This is mentioned in the note box on the opposite page |
| This is trivial, but since the book targets Catalyst version 5.8 on page 57 requires 'Catalyst::Runtime' => '5.7014'; should be requires 'Catalyst::Runtime' => '5.80007'; |
Thanks |
| Page 57 all_from 'lib/LolCatalyst.pm'; should be all_from 'lib/LolCatalyst/Lite.pm'; |
Thanks |
| Chapter 6 - Database Models - page 145 "Add the following in AuthSchema::Users::Result" should read as Auth::Schema::Result::Users |
Thanks |
| In Acknowledgments (page xxiii), Eden Cardim's name is incorrectly spelled "Eden Caram". | Thanks |
| Chapter 2 of the book, page 36, three typos in the last paragraph. "The guest attribute" should be "The guests attribute". "...the name of each quest" should be "the name of each guest." "..reference for the guest attribute" should be "reference for the guests attribute." |
Thanks |
| Chapter 2, page 36, there is a typo. In the has unknown_greeting declaration, the apostrophe in the word "don't" ("I don't know you do I?") should be backslash-escaped. |
Only if the string is delimieted with single quotes. If it's delimited with double quotes, the single quote in "don't" is fine |
| Chapter 2, page 34. The _build_greeting sub and documentation has typos: my $name = $self->name should have a semicolon at the end. END__ should be preceded by two underscores. |
Thankyou. |
| ebook, Chapter 2, page 20: "Next, run it with perl UnknownError.pm." should read: "Next, run it with perl -MUnknownError" |
actually either will do. |
| ebook, Chapter 2, page 30 - use of Test::More qw/no_plan/ (Not an erratum, but seeing as you're hammering on about best practice :-) Test::More(3) advises the use of done_testing(): it says, 'This is safer than and replaces the "no_plan" plan.' |
That's fair enough. Although when the book was written Test::More version 0.86 was current that doesn't have this function. With version 0.88 I would recommend using this instead, as it seems cleaner. |
| ebook, Chapter 2, page 30 - refers to filename t/00-basic.t Filename is in fact t/00-load.t (Note: pages 29 and 31 correctly refer to t/00-load.t) [This report is cross-posted to http://dev.catalyst.perl.org/wiki/apressbook/errata] |
Thanks :) Noted for 2nd edition :) |
| ebook - Introduction - page xxvii: refers to an invalid URL "Please check the Catalyst wiki at http://dev.catalystframework.org/BinaryBuilds to see if a binary distribution is available for your platform." - the URL returns 404 Not Found. (also submitted to the book wiki at http://dev.catalyst.perl.org/wiki/apressbook/errata) |
I have corrected this problem so that the link now works, so while it was an erratum, it is not any more. |
