Errata

Embedding Perl in HTML with Mason

Errata for Embedding Perl in HTML with Mason

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 46
Example 3-5. /autohandler

There are two technical errors with this code.

1) <%init> is closed with </%init>, the "/" is missing from the second block.

2) As written the server throws an error (mason ver. 1.19). Variables declared in the
<%init> blocks are availible to every subsequent block *except* <%filter> blocks. In
fact <%filter> blocks only inherit global variables.

Here is the error.
Error during compilation of
/Library/WebServer/Documents/mason/weplayfaire/autohandler:
Global symbol "$path" requires explicit package name at
/Library/WebServer/Documents/mason/weplayfaire/autohandler line 89.

and the code
81 <%init>
82 (my $path = $r->uri) =~ s,/[^/]+$,,;
83 </%init>
84
85 <%filter>
86 ...
87 ...
88 ...
89 s{(<img[^>]+src=")(?!w+:)} {$1$path/}ig;
90 </%filter>

Anonymous