... ApacheHandler
When you are using Mason under mod _perl with the
HTML: :Mason: :ApacheHandler class, which is covered in Chapter 7
,
the Request object will contain several additional methods. ... handle incoming
parameters by setting args_method to mod _perl, this object will
be an Apache::Request object; otherwise, it will be an Apache
object.
Incoming parameter handling is c...
... , text , line , or html . These produce an
error message with no trace, a multiline error with trace information, a
single-line error with tab-separated fields (suitable for writing to a
log), ... rather than optimize your
code at the expense of increasing its complexity, thus making it less
maintainable.
Caching can also be a big win in providing scalability when you have a...
... concerning the currently executing chain of
components. It is treated in detail in Chapter 4
. Return.
4. Component objects are returned by several of the
HTML: :Mason: :Request and HTML: :Mason: :Interp ... the parts of a single
component. The uses of this block are discussed in Chapter 5
.
Escaping a Newline
When using Mason, you may find that you want to suppress a newlin...
... Embedding Perl in HTML with Mason
Chapter 1: Introduction
At its heart, Mason is simply a mechanism for embedding Perl code into
plain text. It is only one of many ... that
Mason is being used in a web context. Most people using Mason also use it
in conjunction with Apache and mod _perl. The main ingredients involved
in setting up this paradigm are:
•
Perl...
... components contains a simple tag to
do in- place substitution of Perl expressions, a way to mark a single line as
being a line of Perl, and a set of block tags, most of which contain Perl code
that ... new
HTML: :Mason: :Component object. This object, in turn, can be used to
generate the text originally found in the component. In a sense, this inverts
the component, turning...
...
often no filtering is necessary.
Inspecting the Wrapping Chain
When Mason processes a request, it builds the wrapping chain and then
executes each component in the chain, starting with the topmost ... processing, though, because parsing HTML can give you a
stomach ache very quickly. In Chapter 5
you'll see how to use inheritance to
gain finer control over the productio...
... Mason directive that defines one component from within another.
The component embedded within the <%def> block is called a
subcomponent , and it is visible only to the component within ... request.
Now imagine another scenario, one in which the method needs to examine
the incoming arguments in order to generate its output. For instance, suppose
you request /view_user .html? i...
... &>
or, in an Apache configuration file:
PerlSetVar MasonCompRoot 'main => /usr/http/docs'
PerlAddVar MasonCompRoot 'util =>
/usr/http /mason- util'
This brings up ... one in shared.
Using this setup, any component call no matter whether it occurs in a
component located in the mine or shared component root will look for
the indicated component...
... actually processing the component source code
and finding the Mason directives within it. It interacts quite closely with the
Compiler, which takes the Lexer's output and generates a Mason component ... 6-1. The Interpreter and its cronies
Passing Parameters to Mason Classes
An interesting feature of the Mason code is that, if a particular object
contains another object, t...
...
PerlSetVar MasonCompRoot /home/example/htdocs
PerlSetVar MasonDataDir /home/example /mason-
data
<LocationMatch "\.mhtml$">
SetHandler perl- script
PerlHandler HTML: :Mason: :ApacheHandler ... output.
Note that Mason& apos;s templating capabilities aren't exactly taking center stage
in this example. You may ask why Mason is being used in this situatio...