Skip to content

Commit

Permalink
added Mojolicious::Routes::Route
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Mar 20, 2012
1 parent bda1d6c commit b0bf1ed
Show file tree
Hide file tree
Showing 4 changed files with 654 additions and 600 deletions.
3 changes: 2 additions & 1 deletion Changes
@@ -1,7 +1,8 @@
This file documents the revision history for Perl extension Mojolicious.

2.63 2012-03-20 00:00:00
- Added find method to Mojolicious::Routes.
- Added Mojolicious::Routes::Route.
- Added find method to Mojolicious::Routes::Route.
- Improved form_for helper to automatically add method="POST"
attributes when necessary.
- Improved Mojolicious::Renderer performance.
Expand Down
22 changes: 11 additions & 11 deletions lib/Mojolicious/Guides/Routing.pod
Expand Up @@ -183,7 +183,7 @@ class, but the router can be accessed from everywhere (even at runtime).

After you start a new route with the method L<Mojolicious::Routes/"route">,
you can also give it a destination in the form of a hash using the chained
method L<Mojolicious::Routes/"to">.
method L<Mojolicious::Routes::Route/"to">.

# /welcome -> {controller => 'foo', action => 'welcome'}
$r->route('/welcome')->to(controller => 'foo', action => 'welcome');
Expand Down Expand Up @@ -466,8 +466,8 @@ L<Mojolicious::Plugin::DefaultHelpers/"current_route">.

=head2 HTTP methods

The method L<Mojolicious::Routes/"via"> allows only specific HTTP methods to
pass.
The method L<Mojolicious::Routes::Route/"via"> allows only specific HTTP
methods to pass.

# GET /bye -> {controller => 'foo', action => 'bye'}
# POST /bye -> undef
Expand Down Expand Up @@ -639,7 +639,7 @@ snowman very sad.
=head2 WebSockets

You can restrict access to WebSocket handshakes using the method
L<Mojolicious::Routes/"websocket">.
L<Mojolicious::Routes::Route/"websocket">.

# /echo (WebSocket handshake)
$r->websocket('/echo')->to(controller => 'foo', action => 'echo');
Expand Down Expand Up @@ -686,9 +686,9 @@ play, they are basically router plugins.
$r->route('/firefox_only')->over(agent => qr/Firefox/)
->to(controller => 'foo', action => 'bar');

The method L<Mojolicious::Routes/"add_condition"> registers the new condition
in the router, while L<Mojolicious::Routes/"over"> actually applies it to the
route.
The method L<Mojolicious::Routes::Route/"add_condition"> registers the new
condition in the router, while L<Mojolicious::Routes/"over"> actually applies
it to the route.

=head2 Condition plugins

Expand Down Expand Up @@ -758,10 +758,10 @@ domain specific language in normal L<Mojolicious> controllers.

1;

With the method L<Mojolicious::Routes/"detour"> which is very similar to
L<Mojolicious::Routes/"to">, you can allow the route to partially match and
use only the remaining path in the embedded application, the base path will
be passed along in the C<path> stash value.
With the method L<Mojolicious::Routes::Route/"detour"> which is very similar
to L<Mojolicious::Routes::Route/"to">, you can allow the route to partially
match and use only the remaining path in the embedded application, the base
path will be passed along in the C<path> stash value.

# /foo/*
$r->route('/foo')->detour('bar#', name => 'Mojo');
Expand Down

0 comments on commit b0bf1ed

Please sign in to comment.