HTML::Mason::Parser - Mason Component Parser

- NAME
- SYNOPSIS
- DESCRIPTION
- PARAMETERS FOR new() CONSTRUCTOR
- AUTHOR
- SEE ALSO

# NAME

HTML::Mason::Parser - Mason Component Parser

# SYNOPSIS

        my $p = new HTML::Mason::Parser (...params...);

# DESCRIPTION

A Parser object translates components into Perl subroutines. Parsers are typically embedded within (and used by) Interp objects.

# PARAMETERS FOR new() CONSTRUCTOR

ignore_warnings_expr
  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.

preamble
  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).

postamble
  A piece of Perl code to insert at the end of every compiled subroutine. Blank by default.

source_refer_predicate
  Reference to a subroutine that decides whether a given component should be compiled with source references. 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.

use_strict
  Indicates whether to use strict in compiled subroutines. 1 by default.

# AUTHOR

Jonathan Swartz, swartz@transbay.net

# SEE ALSO

HTML::Mason, HTML::Mason::Interp, HTML::Mason::ApacheHandler, HTML::Mason::Admin