Skip to content

Commit

Permalink
added example for optional placeholder in the middle of a pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jan 21, 2014
1 parent f87ceab commit 9cbbf13
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/Mojolicious/Guides/Routing.pod
Expand Up @@ -356,6 +356,11 @@ there is already a stash value of the same name present.
$r->route('/:mymessage')
->to(controller => 'foo', action => 'bar', mymessage => 'hi');

# /test123 -> {controller => 'foo', action => 'bar', mymessage => 'hi'}
# /testbye123 -> {controller => 'foo', action => 'bar', mymessage => 'bye'}
$r->route('/test(:mymessage)123')
->to(controller => 'foo', action => 'bar', mymessage => 'hi');

This is also the case if multiple placeholders are right after another and not
separated by other characters than C</>.

Expand Down

0 comments on commit 9cbbf13

Please sign in to comment.