NAME

MojoX::Routes - Routes

SYNOPSIS

use MojoX::Routes;

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

DESCRIPTION

MojoX::Routes is a routes implementation.

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

segments

my $segments = $routes->segments;

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

defaults

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

is_endpoint

my $is_endpoint = $routes->is_endpoint;

match

my $match = $routes->match($tx);

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

waypoint

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