Mojolicious::Plugin::AttributeMaker::Extension::Routing - Catalyst like routing in you Mojolicious app!
Version 0.01
Example:
package Simple; sub homepage :Local { ... } http://*:port/simple/homepage
The Local attribute does not use (ignores) arguments
package Simple; sub homepage :Path('user_home') { ... } http://*:port/simple/user_home
The Path attribute requires one argument. If given parameter has a slash in it (i.e. "Path('/user_home')") then his behaviour will match the Global attribute behaviour and will refer to URL root folder ('http://mysite.host/user_home') If given parameter has NO slash in it (i.e. "Path('user_home')") then generated link will use controller name and the parameter given in the attribute ('http://mysite.host/CONTROLLER_NAME/user_home')
sub homepage :Global { ... } http://*:port/homepage
A global action defined in any controller always runs relative to your root. So the above is the same as:
sub myaction :Path("/homepage") { ... }
But if you write this:
sub homepage :Global('/homepage_custom_url') { ... }
You will get this result:
http://*:port/homepage_custom_url
To install Mojolicious::Plugin::AttributeMaker, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mojolicious::Plugin::AttributeMaker
CPAN shell
perl -MCPAN -e shell install Mojolicious::Plugin::AttributeMaker
For more information on module installation, please visit the detailed CPAN module installation guide.