Skip to content

Commit

Permalink
tweaked format detection recipe
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Apr 15, 2012
1 parent 85d9487 commit 3fd8194
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/Mojolicious/Guides/Routing.pod
Expand Up @@ -417,8 +417,8 @@ Restrictive placeholders can also be used for format detection.
$r->route('/foo', format => ['rss', 'xml'])
->to(controller => 'foo', action => 'feed');

Or you can just disable format detection, it gets inherited by nested routes
and can be re-enabled selectively.
Or you can just disable format detection, which gets inherited by nested routes
and allows re-enabling detection selectively.

# /foo -> {controller => 'foo', action => 'none'}
# /foo.html -> undef
Expand All @@ -430,9 +430,9 @@ and can be re-enabled selectively.
# /bar.txt -> {controller => 'bar', action => 'hyper', format => 'txt'}
# /bar.html -> {controller => 'bar', action => 'hyper', format => 'html'}
# /bar.xml -> undef
my $no_detect = $r->route(format => 0);
$no_detect->route('/foo')->to('foo#none');
$no_detect->route('/bar', format => ['txt', 'html'])->to('bar#hyper');
my $inactive = $r->route(format => 0);
$inactive->route('/foo')->to('foo#none');
$inactive->route('/bar', format => ['txt', 'html'])->to('bar#hyper');

=head2 Named routes

Expand Down

0 comments on commit 3fd8194

Please sign in to comment.