Skip to content

Commit

Permalink
more url_for examples
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Dec 2, 2017
1 parent 1801917 commit 0c513be
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/Mojolicious/Controller.pm
Expand Up @@ -904,6 +904,18 @@ C<mojo.*> prefix are reserved for internal use.
Generate a portable L<Mojo::URL> object with base for a path, URL or route.
# Rebuild URL for the current route
$c->url_for;
# Rebuild URL for the current route, but replace the "name" placeholder value
$c->url_for(name => 'sebastian');
# Absolute URL for the current route
$c->url_for->to_abs;
# Build URL for route "test" with two placeholder values
$c->url_for('test', name => 'sebastian', foo => 'bar');
# "http://127.0.0.1:3000/index.html" if application was started with Morbo
$c->url_for('/index.html')->to_abs;
Expand Down

0 comments on commit 0c513be

Please sign in to comment.