Skip to content

Commit

Permalink
Additional documentation about file extentions and format detection
Browse files Browse the repository at this point in the history
  • Loading branch information
jberger committed Feb 24, 2015
1 parent a3629c3 commit 7635abc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/Mojolicious/Guides/FAQ.pod
Expand Up @@ -225,6 +225,15 @@ will force the affected worker to be restarted after a timeout. This timeout
defaults to C<20> seconds and can be extended with the attribute
L<Mojo::Server::Prefork/"heartbeat_timeout"> if your application requires it.

=head2 Why is the file extension missing from the stash value?

Mojolicious detects L<Mojolicious::Guides::Routing/Formats> by default. The
file extension is then available via the stash key C<format>. Note that
L<Mojolicious::Guides::Routing/"Generic placeholders"> do not match a C<.>
in order to make format detection easier. To match the extension manually,
use L<Mojolicious::Guides::Routing/"Relaxed placeholders"> or
L<Mojolicious::Guides::Routing/"Wildcard placeholders">.

=head1 MORE

You can continue with L<Mojolicious::Guides> now or take a look at the
Expand Down
5 changes: 5 additions & 0 deletions lib/Mojolicious/Guides/Routing.pod
Expand Up @@ -131,6 +131,11 @@ C<([^/]+)>.
/sebastian23/hello -> /#name/hello -> {name => 'sebastian23'}
/sebastian 23/hello -> /#name/hello -> {name => 'sebastian 23'}

Relaxed placeholders are especially useful for manually matching file names
with extensions rather than using L<"Format detection"|/"Formats">.

/music/song.mp3 -> /music/#filename -> {filename => 'song.mp3'}

=head2 Wildcard placeholders

Wildcard placeholders are just like the two placeholders above, but use an
Expand Down

0 comments on commit 7635abc

Please sign in to comment.