HTML::Mason::Parser - Mason Component Parser
my $p = new HTML::Mason::Parser (...params...);
A Parser object translates components into Perl subroutines. Parsers are typically embedded within (and used by) Interp objects.
Regular expression indicating which warnings to ignore when compiling subroutines. Any warning that is not ignored will prevent the component from being compiled and executed. For example:
ignore_warnings_expr => 'Global symbol.*requires explicit package'
Undefined by default, meaning that all warnings are fatal.
A piece of Perl code to insert at the beginning of every compiled subroutine. Blank by default, but ApacheHandler adds the line
use vars qw($r);
to suppress strict warnings about uses of global $r (the Apache request object).
A piece of Perl code to insert at the end of every compiled subroutine. Blank by default.
Reference to a subroutine that decides whether a given component should be compiled with "source references" in Admin. The subroutine takes two arguments: first, the total number of characters in the component source; second, the number of characters devoted to plain text. For example, this component:
% my $noun = "World"; Hello, <% $noun %>! How are ya?
Has 51 total bytes, 19 of which are plain text. This allows you to adjust the trade-off between the memory savings of source references and the performance advantage of in-line plain text. For example, to choose only components with at least 50% plain text:
source_refer_predicate => sub { return $_[1] / $_[0] >= 0.5 }
The current default is
sub { return $_[1] >= 500 }
i.e. any component with at least 500 characters. This is an experimental setting and may change.
Indicates whether to use strict in compiled subroutines. 1 by default.
Jonathan Swartz, swartz@transbay.net
HTML::Mason, HTML::Mason::Interp, HTML::Mason::ApacheHandler, HTML::Mason::Admin
To install HTML::Mason, copy and paste the appropriate command in to your terminal.
cpanm
cpanm HTML::Mason
CPAN shell
perl -MCPAN -e shell install HTML::Mason
For more information on module installation, please visit the detailed CPAN module installation guide.