HTML::Mason::Request - Mason Request Class
Mason creates one Request object for every web request (or, in stand-alone mode, every
Interp::exec call). Inside a component you access the current request object via the global
Prior to version 0.7, the only way to access request information was through specific mc_ commands. For this reason many of the methods below have mc_ command equivalents; you are free to use either interface.
- abort ([return value])
Ends the current request, finishing the page without returning through components. The optional argument specifies the return value from
Interp::exec; in a web environment, this ultimately becomes the HTTP status code. This method is used to implement
- call (comp, option=>value, ...[, STORE=>ref])
Calls the component designated by comp with the specified option/value pairs. comp may be an absolute or relative component path, or a component object.
The optional STORE option causes all output to be placed in the scalar reference provided instead of being sent to the default output stream.
This method is used to implement
mc_compand the <& &> tag.
With no arguments, returns the current component stack as a list of component objects, starting with the current component and ending with the top-level component. With one numeric argument, returns the component object at that index in the list. e.g.
$REQ->callers(0) # current component $REQ->callers(1) # component that called us $REQ->callers(-1) # top-level component
Returns the current component object.
Returns the number of this request, which is unique for a given request and interpreter.
Returns the current size of the component stack. The lowest possible value is 1, which indicates we are in the top-level component.
If the request has been handled by a dhandler, this method returns the remainder of the URI or
Interp::execpath when the dhandler directory is removed. Otherwise returns undef. This method is used to implement
- fetch_comp (compPath)
Given an absolute or relative component path, returns the corresponding component object or undef if no such component exists. Looks for subcomponents as well as file-based components.
Returns the Interp object associated with this request.
Returns the Parser object associated with this request.
- process_comp_path (compPath)
Given an absolute or relative component path, returns the corresponding absolute component path.
These additional methods are available when running Mason with mod_perl and the ApacheHandler.
Returns the ApacheHandler object associated with this request.
Returns the input string for this HTTP request: for GET, the query string, and for POST, the content block read from the client. Because $r->content can only be called once and is automatically called by Mason, it cannot be called directly inside components; this method is a good way to get at the value of $r->content.
Returns the Apache request object. This is also available in the global $r.
Jonathan Swartz, firstname.lastname@example.org