Skip to content

Commit

Permalink
more details
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Feb 18, 2016
1 parent 2881eb1 commit 569ae3e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/Mojolicious/Guides/Routing.pod
Expand Up @@ -812,17 +812,19 @@ For a full list of available hooks see L<Mojolicious/"HOOKS">.

Less commonly used and more powerful features.

=head2 Adding placeholders types
=head2 Adding placeholder types

Restrictive placeholders can get repetitive, use
L<Mojolicious::Routes/"add_type"> to create your own placeholder types.
L<Restrictive placeholders/"Restrictive placeholders"> can get repetitive, use
L<Mojolicious::Routes/"add_type"> to create your own placeholder types instead.

# Simple "isbn10" type
$r->add_type(isbn10 => qr/\d{9}(?:\d|X)/);

# GET /library/0596001738
$r->get('/library/(book:isbn10)')->to('library#info');

Just remember not to use C<^> and C<$> or capturing groups C<(...)> in your
regular expressions.

=head2 Shortcuts

To make route generation more expressive, you can also add your own shortcuts
Expand Down
2 changes: 2 additions & 0 deletions lib/Mojolicious/Routes.pm
Expand Up @@ -321,6 +321,8 @@ Register a shortcut.
Register a placeholder type.
$r->add_type(hex => qr/[a-f0-9]/);
=head2 continue
$r->continue(Mojolicious::Controller->new);
Expand Down

0 comments on commit 569ae3e

Please sign in to comment.