NAME

MojoX::Routes - Routes

SYNOPSIS

use MojoX::Routes;

my $routes = MojoX::Routes->new;

DESCRIPTION

MojoX::Routes is a routes implementation.

ATTRIBUTES

MojoX::Routes implements the following attributes.

block

my $block = $routes->block;
$routes   = $routes->block(1);

children

my $children = $routes->children;
$routes      = $routes->children([MojoX::Routes->new]);

inline

my $inline = $routes->inline;
$routes    = $routes->inline(1);

name

my $name = $routes->name;
$routes  = $routes->name('foo');

parent

my $parent = $routes->parent;
$routes    = $routes->parent(MojoX::Routes->new);

pattern

my $pattern = $routes->pattern;
$routes     = $routes->pattern(MojoX::Routes::Pattern->new);

METHODS

MojoX::Routes inherits all methods from Mojo::Base and implements the follwing the ones.

new

my $routes = MojoX::Routes->new;
my $routes = MojoX::Routes->new('/:controller/:action');

bridge

my $bridge = $routes->bridge;
my $bridge = $routes->bridge('/:controller/:action');

to

my $to  = $routes->to;
$routes = $routes->to(action => 'foo');
$routes = $routes->to({action => 'foo'});

is_endpoint

my $is_endpoint = $routes->is_endpoint;

match

$match = $routes->match($match);
my $match = $routes->match('/foo/bar');
my $match = $routes->match(get => '/foo/bar');

parse

$routes = $routes->parse('/:controller/:action');

route

my $route = $routes->route('/:c/:a', a => qr/\w+/);

to_string

my $string = $routes->to_string;

url_for

my $url = $routes->url_for($url);
my $url = $routes->url_for($url, {foo => 'bar'});

via

$routes = $routes->via('get');
$routes = $routes->via(qw/get post/);
$routes = $routes->via([qw/get post/]);

waypoint

my $route = $routes->waypoint('/:c/:a', a => qr/\w+/);