MojoX::Routes - Routes
use MojoX::Routes; my $routes = MojoX::Routes->new;
MojoX::Routes is a routes implementation.
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]);
conditions
my $conditions = $routes->conditions; $routes = $routes->conditions([foo => qr/\w+/]);
dictionary
my $dictionary = $routes->dictionary; $routes = $routes->dictionary({foo => sub { ... }});
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);
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');
add_condition
$routes = $routes->add_condition(foo => sub { ... });
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');
over
$routes = $routes->over(foo => qr/\w+/); $routes = $routes->over({foo => qr/\w+/});
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+/);
To install Mojo, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mojo
CPAN shell
perl -MCPAN -e shell install Mojo
For more information on module installation, please visit the detailed CPAN module installation guide.