MojoX::Routes::Match(3) Routes Visitor

SYNOPSIS


use MojoX::Routes::Match;
# New match object
my $m = MojoX::Routes::Match->new($tx);
# 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.

tx

    my $tx = $m->tx;
    $m     = $m->tx(Mojo::Transaction::HTTP->new);

Transaction object used for matching.

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(Mojo::Transaction::HTTP->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.