Evgeniy ☢ Vansevich
and 1 contributors

NAME

Mojolicious::Plugin::AttributeMaker::Extension::Routing - Catalyst like routing in you Mojolicious app!

VERSION

Version 0.01

ATTRIBUTES

Local

Example:

    package Simple;
    sub homepage :Local { ... }
    
    http://*:port/simple/homepage

The Local attribute does not use (ignores) arguments

Path

Example:

    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')

Global

Example:

    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