Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

mason::manual::requestdispatch(3pm) [debian man page]

Mason::Manual::RequestDispatch(3pm)			User Contributed Perl Documentation		       Mason::Manual::RequestDispatch(3pm)

NAME
Mason::Manual::RequestDispatch - How request paths get mapped to page components DESCRIPTION
Given the request path /news/sports/hockey Mason searches for the following components in order, setting $m->path_info as noted. /news/sports/hockey.{mp,mc} /news/sports/hockey/index.{mp,mc} /news/sports/hockey/dhandler.{mp,mc} /news/sports/dhandler.{mp,mc} # $m->path_info = hockey /news/sports.{mp,mc} # $m->path_info = hockey (but see next section) /news/dhandler.{mp,mc} # $m->path_info = sports/hockey /news.{mp,mc} # $m->path_info = sports/hockey (but see next section) /dhandler.{mp,mc} # $m->path_info = news/sports/hockey where ".{mp,mc}" means either ".mp" (indicating a pure-perl component). or ".mc" (indicating a top-level component). The following sections describe these elements in more detail. Autoextended path The request path is suffixed with ".mp" and ".mc" to translate it to a component path. /news/sports/hockey.{mp,mc} Index An index matches its exact directory, nothing underneath. /news/sports/hockey/index.{mp,mc} Dhandlers A dhandler matches its directory as well as anything underneath, setting "$m->path_info" to the remainder. /news/sports/hockey/dhandler.{mp,mc} /news/sports/dhandler.{mp,mc} # $m->path_info = hockey /news/dhandler.{mp,mc} # $m->path_info = sports/hockey /dhandler.{mp,mc} # $m->path_info = news/sports/hockey Partial paths A component can match an initial part of the URL, setting "$m->path_info" to the remainder: /news/sports.{mp,mc} # $m->path_info = hockey /news.{mp,mc} # $m->path_info = sports/hockey Since this isn't always desirable behavior, it must be explicitly enabled for the component. Mason will call method "allow_path_info" on the component class, and will only allow the match if it returns true: <%class> method allow_path_info { 1 } </%class> The default "allow_path_info" returns false. "allow_path_info" is not checked on dhandlers, since the whole point of dhandlers is to match partial paths. Routes It is possible to use route syntax to more elegantly parse "$m->path_info" for dhandlers and partial paths, e.g. <%class> route "{year:[0-9]+}/{month:[0-9]{2}}"; </%class> See Mason::Plugin::RouterSimple. SEE ALSO
Mason AUTHOR
Jonathan Swartz <swartz@pobox.com> COPYRIGHT AND LICENSE
This software is copyright (c) 2011 by Jonathan Swartz. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. perl v5.14.2 2012-05-02 Mason::Manual::RequestDispatch(3pm)

Check Out this Related Man Page

HTML::Mason::Resolver(3pm)				User Contributed Perl Documentation				HTML::Mason::Resolver(3pm)

NAME
HTML::Mason::Resolver - Component path resolver base class SYNOPSIS
# make a subclass and use it DESCRIPTION
The resolver is responsible for translating a component path like /foo/index.html into a component. By default, Mason expects components to be stored on the filesystem, and uses the HTML::Mason::Resolver::File class to get information on these components. The HTML::Mason::Resolver provides a virtual parent class from which all resolver implementations should inherit. Class::Container This class is used by most of the Mason object's to manage constructor parameters and has-a relationships with other objects. See the documentation on this class for details on how to declare what paremeters are valid for your subclass's constructor. HTML::Mason::Resolver is a subclass of Class::Container so you do not need to subclass it yourself. METHODS
If you are interested in creating a resolver subclass, you must implement the following methods. new This method is optional. The new method included in this class is simply inherited from "Class::Container". If you need something more complicated done in your new method you will need to override it in your subclass. get_info Takes three arguments: an absolute component path, a component root key, and a component root path. Returns a new HTML::Mason::ComponentSource object. glob_path Takes two arguments: a path glob pattern, something like "/foo/*" or "/foo/*/bar", and a component root path. Returns a list of component paths for components which match this glob pattern. For example, the filesystem resolver simply appends this pattern to the component root path and calls the Perl "glob()" function to find matching files on the filesystem. Using a Resolver with HTML::Mason::ApacheHandler If you are creating a new resolver that you intend to use with the HTML::Mason::ApacheHandler module, then you must implement the following method as well. apache_request_to_comp_path ($r, @comp_root_array) This method, given an Apache object and a list of component root pairs, should return a component path or undef if none exists. This method is used by the HTML::Mason::ApacheHandler class to translate web requests into component paths. You can omit this method if your resolver subclass will never be used in conjunction with HTML::Mason::ApacheHandler. SEE ALSO
HTML::Mason perl v5.14.2 2012-02-04 HTML::Mason::Resolver(3pm)
Man Page