Created
February 14, 2011 04:43
-
-
Save kraih/825495 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use Mojolicious::Routes; | |
use Mojolicious::Routes::Match; | |
# Create some routes | |
my $r = Mojolicious::Routes->new; | |
$r->get('/:action')->to(controller => 'foo'); | |
# Match method and path against routes | |
my $m = Mojolicious::Routes::Match->new(GET => '/bar')->match($r); | |
# Results | |
print $m->captures->{controller}, "\n"; | |
print $m->captures->{action}, "\n"; | |
# Generate path from route | |
print $m->path_for(action => 'baz'), "\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment