MojoX::Routes::Match.3pm

Langue: en

Version: 2010-08-14 (fedora - 01/12/10)

Section: 3 (Bibliothèques de fonctions)

NAME

MojoX::Routes::Match - Routes Visitor

SYNOPSIS

     use MojoX::Routes::Match;
 
     # New match object
     my $m = MojoX::Routes::Match->new($c);
 
     # Match
     $m->match($routes);
 
 

DESCRIPTION

MojoX::Routes::Match is a visitor for MojoX::Routes structures.

ATTRIBUTES

MojoX::Routes::Match implements the following attributes.

captures

     my $captures = $m->captures;
     $m           = $m->captures({foo => 'bar'});
 
 

Captured parameters.

endpoint

     my $endpoint = $m->endpoint;
     $m           = $m->endpoint(MojoX::Routes->new);
 
 

The routes endpoint that actually matched.

root

     my $root = $m->root;
     $m       = $m->root($routes);
 
 

The root of the routes tree.

stack

     my $stack = $m->stack;
     $m        = $m->stack([{foo => 'bar'}]);
 
 

Captured parameters with nesting history.

METHODS

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

new

     my $m = MojoX::Routes::Match->new;
     my $m = MojoX::Routes::Match->new(MojoX:Controller->new);
 
 

Construct a new match object.

match

     $m->match(MojoX::Routes->new);
 
 

Match against a routes tree.

url_for

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

Render matching route with parameters into a Mojo::URL object.

SEE ALSO

Mojolicious, Mojolicious::Guides, <http://mojolicious.org>.