[Catalyst-commits] r9397 - Catalyst-Runtime/5.70/trunk/lib
hkclark at dev.catalyst.perl.org
hkclark at dev.catalyst.perl.org
Wed Feb 25 20:43:49 GMT 2009
Author: hkclark
Date: 2009-02-25 20:43:49 +0000 (Wed, 25 Feb 2009)
New Revision: 9397
Modified:
Catalyst-Runtime/5.70/trunk/lib/Catalyst.pm
Log:
Apply doc patch from Genius_Spot
Modified: Catalyst-Runtime/5.70/trunk/lib/Catalyst.pm
===================================================================
--- Catalyst-Runtime/5.70/trunk/lib/Catalyst.pm 2009-02-24 22:11:53 UTC (rev 9396)
+++ Catalyst-Runtime/5.70/trunk/lib/Catalyst.pm 2009-02-25 20:43:49 UTC (rev 9397)
@@ -1022,11 +1022,19 @@
=item $action
A Catalyst::Action object representing the Catalyst action you want to
-create a URI for. To get one for an action in the current controller,
-use C<< $c->action('someactionname') >>. To get one from different
-controller, fetch the controller using C<< $c->controller() >>, then
-call C<action_for> on it.
+create a URI for.
+To get an action object:
+
+ From another controller, anywhere:
+ C<< $c->controller('ControllerName')->action_for('someactionname') >>
+ Shorter styles useful in particular places:
+ In the current controller's action method:
+ C<< $self->action_for('someactionname') >>
+ From the view for currently dispatched action:
+ C<< $c->controller->action_for('someactionname') >>
+
+
This method must be used to create URIs for
L<Catalyst::DispatchType::Chained> actions.
@@ -1057,7 +1065,7 @@
Returns a L<URI> object.
## Ex 1: a path with args and a query parameter
- $c->uri_for('user/list', 'short', { page => 2});
+ $c->uri_for($c->controller('User')->action_for('list'), 'short', { page => 2});
## -> ($c->req->base is 'http://localhost:3000/'
URI->new('http://localhost:3000/user/list/short?page=2)
@@ -1072,6 +1080,11 @@
## outputs:
URI->new('http://localhost:3000/myuser/42/view')
+ ## Ex 3: this style is deprecated and should be omitted
+ $c->uri_for('user/list', 'short', { page => 2});
+ ## -> ($c->req->base is 'http://localhost:3000/'
+ URI->new('http://localhost:3000/user/list/short?page=2)
+
Creates a URI object using C<< $c->request->base >> and a path. If an
Action object is given instead of a path, the path is constructed
using C<< $c->dispatcher->uri_for_action >> and passing it the
More information about the Catalyst-commits
mailing list