The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

HTML::Mason::Request - Mason Request Class

SYNOPSIS

    $m->abort (...)
    $m->comp (...)
    etc.

DESCRIPTION

The Request API is your gateway to all Mason features not provided by syntactic tags. Mason creates a new Request object for every web request. Inside a component you access the current request object via the global $m. Outside of a component, you can use the class method instance.

COMPONENT PATHS

The methods Request->comp, Request->comp_exists, and Request->fetch_comp take a component path argument. Component paths are like URL paths, and always use a forward slash (/) as the separator, regardless of what your operating system uses.

  • If the path is absolute (starting with a '/'), then the component is found relative to the component root.

  • If the path is relative (no leading '/'), then the component is found relative to the current component directory.

  • If the path matches both a subcomponent and file-based component, the subcomponent takes precedence.

CONSTRUCTOR PARAMETERS

autoflush

Indicates whether or not to delay sending output until all output has been generated.

data_cache_defaults

The default parameters used when $m->cache is called.

dhandler_name

File name used for dhandlers. Default is "dhandler".

error_format

The format used to display errors. The options are 'brief', 'text', 'line', and 'html'. The default is 'text' except when running under ApacheHandler, in which case the default is 'html'.

error_mode

This can be either 'fatal' or 'output'. If the mode is 'fatal', errors generate an exception. With 'output' mode, the error is sent to the same output as normal component output. The default is 'fatal', except when running under ApacheHandler or CGIHandler, in which case the output is 'default'.

max_recurse

The maximum recursion depth for the component stack, for the request stack, and for the inheritance stack. An error is signalled if the maximum is exceeded. Default is 32.

out_method

Indicates where to send output. If out_method is a reference to a scalar, output is appended to the scalar. If out_method is a reference to a subroutine, the subroutine is called with each output string. For example, to send output to a file called "mason.out":

    my $fh = new IO::File ">mason.out";
    ...
    out_method => sub { $fh->print($_[0]) }

By default, out_method prints to standard output. When the HTML::Mason::ApacheHandler module is used, the out method uses the $r->print method to send output.

METHODS

APACHE-ONLY METHODS

These additional methods are available when running Mason with mod_perl and the ApacheHandler.

APACHE- OR CGI-ONLY METHOD

This method is available when Mason is running under either the ApacheHandler or CGIHandler modules.

AUTHORS

Jonathan Swartz <swartz@pobox.com>, Dave Rolsky <autarch@urth.org>, Ken Williams <ken@mathforum.org>

SEE ALSO

HTML::Mason, HTML::Mason::Devel, HTML::Mason::Component

3 POD Errors

The following errors were encountered while parsing the POD:

Around line 1021:

You can't have =items (as at line 1025) unless the first thing after the =over is an =item

Around line 1491:

You can't have =items (as at line 1495) unless the first thing after the =over is an =item

Around line 1526:

You can't have =items (as at line 1530) unless the first thing after the =over is an =item