X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst.pm;h=8b8cb3f165b87655c7832e0c394161cfa79817e4;hb=f04fdedae056296d0fa97fbdcaa85b9811ca6a5b;hp=5294064bafe8faebc97a4a111ebbf56eb8d4294c;hpb=e73e3bad5248d5d16e6b32024ca341d1208e7bcb;p=catagits%2FCatalyst-Runtime.git
diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm
index 5294064..8b8cb3f 100644
--- a/lib/Catalyst.pm
+++ b/lib/Catalyst.pm
@@ -1022,10 +1022,18 @@ EOF
=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 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 actions.
@@ -1057,7 +1065,7 @@ to the URI, with the keys as the names, and the values as the values.
Returns a L 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 @@ Returns a L object.
## 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
@@ -1266,7 +1279,7 @@ sub welcome_message {
they can save you a lot of work.
script/${prefix}_create.pl -help
Also, be sure to check out the vast and growing
- collection of plugins for Catalyst on CPAN;
+ collection of plugins for Catalyst on CPAN;
you are likely to find what you need there.