Provided by: libmason-plugin-routersimple-perl_0.07-1_all bug

NAME

       Mason::Plugin::RouterSimple - Specify routes for page components

VERSION

       version 0.07

SYNOPSIS

       In a top-level component '/archives.mc':

           <%class>
           route ":section/{year:[0-9]{4}}/{month:[0-9]{2}}";
           </%class>

           Archives for <b><% $.section %></b>
           For the month of <% $.month %>/<% $.year %>

       then "/archives/news/2010/02" outputs

           Archives for <b>news</b>
           For the month of 2010/02

DESCRIPTION

       See Mason::Manual::RequestDispatch for background on how request paths get mapped to page
       components.

       This plugin allows you to parse "$m->path_info" (the remainder of the top-level path)
       using Router::Simple routes.

       It can be used whenever "$m->path_info" is set, i.e. with a dhandler or with a partial
       path.

       Use the "route" keyword to declare routes in a <%class> block.  Like
       Router::Simple::connect, "route" takes a string/regex pattern and a destination hashref;
       the latter defaults to "{}" if omitted. e.g.

           <%class>
           route "wiki/:page", { action => "wiki" };
           route "download/*.*", { action => "download" };
           route "blog/{year:[0-9]+}/{month:[0-9]{2}}";
           </%class>

       This plugin overrides the default allow_path_info to return true for any component that
       declares at least one route. For components that do not declare a route, you will need to
       override "allow_path_info" as usual.

       Any named captured arguments, including "splat", are placed in component attributes, which
       are automatically declared (as standard read-write attributes) if you do not otherwise
       declare them.

       If you specify more than one route in a component, they will be tried in turn, with the
       first matching route taking precedence.

       If none of the routes match, the request will be declined; in a web context this generally
       means a 404.

       e.g. Given the route declarations above in a component named '/site.mc',

       ·   The URL "/site/wiki/HomePage" will set "$.action = "wiki"" and "$.page = "HomePage"".

       ·   The URL "/site/download/ping.mp3" will set "$.action = "download"" and "$.splat =
           ['ping', 'mp3']".

       ·   The URL "/site/blog/2010/02" will set "$.year = "2010"" and "$.month = "02"".

       ·   The URLs "/site/other" and "/site/blog/10/02" will result in a decline/404.

SUPPORT

       The mailing list for Mason and Mason plugins is mason-users@lists.sourceforge.net. You
       must be subscribed to send a message.  To subscribe, visit
       https://lists.sourceforge.net/lists/listinfo/mason-users
       <https://lists.sourceforge.net/lists/listinfo/mason-users>.

       You can also visit us at "#mason" on <irc://irc.perl.org/#mason>.

       Bugs and feature requests will be tracked at RT:

           http://rt.cpan.org/NoAuth/Bugs.html?Dist=Mason-Plugin-RouterSimple
           bug-mason-plugin-routersimple@rt.cpan.org

       The latest source code can be browsed and fetched at:

           http://github.com/jonswar/perl-mason-plugin-routersimple
           git clone git://github.com/jonswar/perl-mason-plugin-routersimple.git

SEE ALSO

       Mason, Router::Simple

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.