NAME
MojoX::Routes::Pattern - Pattern
SYNOPSIS
use MojoX::Routes::Pattern;
my $pattern = MojoX::Routes::Pattern->new;
DESCRIPTION
MojoX::Routes::Pattern is a route pattern container.
ATTRIBUTES
MojoX::Routes::Pattern implements the following attributes.
defaults
my $defaults = $pattern->defaults;
$pattern = $pattern->defaults({foo => 'bar'});
pattern
my $pattern = $pattern->pattern;
$pattern = $pattern->pattern('/(foo)/(bar)');
quote_end
my $quote = $pattern->quote_end;
$pattern = $pattern->quote_end(']');
quote_start
my $quote = $pattern->quote_start;
$pattern = $pattern->quote_start('[');
regex
my $regex = $pattern->regex;
$pattern = $pattern->regex(qr/\/foo/);
relaxed_start
my $relaxed = $pattern->relaxed_start;
$pattern = $pattern->relaxed_start('*');
reqs
my $reqs = $pattern->reqs;
$pattern = $pattern->reqs({foo => qr/\w+/});
symbol_start
my $symbol = $pattern->symbol_start;
$pattern = $pattern->symbol_start(':');
symbols
my $symbols = $pattern->symbols;
$pattern = $pattern->symbols(['foo', 'bar']);
tree
my $tree = $pattern->tree;
$pattern = $pattern->tree([ ... ]);
wildcard_start
my $wildcard = $pattern->wildcard_start;
$pattern = $pattern->wildcard_start('*');
METHODS
MojoX::Routes::Pattern inherits all methods from Mojo::Base and implements the follwing the ones.
new
my $pattern = MojoX::Routes::Pattern->new('/(controller)/(action)',
action => qr/\w+/
);
match
my $result = $pattern->match('/foo/bar');
parse
$pattern = $pattern->parse('/(controller)/(action)', action => qr/\w+/);
render
my $string = $pattern->render(action => 'foo');
my $string = $pattern->render({action => 'foo'});
shape_match
my $result = $pattern->shape_match(\$path);