Errata

Perl Template Toolkit

Errata for Perl Template Toolkit

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 116
3rd paragraph

The last line should be
"Slartibartfast is from Magrethea"
Should be:
"Slartibartfast from Magrethea",

Anonymous   
Printed Page 209
2nd paragraph, demonstrating 'dir' method

The 'dir' method example incorrectly reuses the 'name' method from the previous
example, rather than itself. E.g.:

[% file.name %]

when it should be:

[% file.dir %]

Anonymous   
Printed Page 303
Sample code for Template::Plugin::Filter

The example code as shown does not work.
The first line in the filter subroutine:

sub filter {
my $text = shift;

should be corrected to:

sub filter {
my ($self, $text) = @_;

Anonymous   
Printed Page 376
Example 10.2

Line 2, before [FOREACH loop
Insert line: % total = 0 %]

product is uninitialized which results in perl warning
'Argument "" isn't numeric in addition (+) at products.tt'.

walterarlenhenry  Jul 29, 2010 
Printed Page 398
follows 3rd paragraph

The excerpt from Example 11-3 (page 396) misquotes a line:

define rooturl = /ttbook/index.html

should be:

define rooturl = /ttbook

Anonymous   
Printed Page 428
Example 11-44

I am almost certain that there is an error with config/expand on page 428 of the
book.
The section of the code
IF item.here;
page.prev = map.page.${loop.last};
page.next = map.page.${loop.next};
END
page.prev was appearing undefined when I was working on the Previous and Next
navigation in example 11-54.

When I changed the page.prev line to

page.prev = map.page.${loop.prev}; the code behaved as expected.

Am I right in thinking that the example in the book would only have page.prev set as
true if the iterator is currently on the last iteration of the set?

Anonymous   
Printed Page 477
last paragraph (last line before footnote)

$param =~ s/*/\%/g; # change '*' to '%'

is not correct. The naked asterisk in the regex means "0 or more characters."
However, your intention (as stated by the comment, in fact) is to change actual
asterisks in the string value to percent characters. Therefore, the asterisk must be
escaped. So this line should be as follows:

$param =~ s/*/\%/g; # change '*' to '%'

Anonymous