[Catalyst-commits] r7285 -
trunk/examples/CatalystAdvent/root/2007/pen
purge at dev.catalyst.perl.org
purge at dev.catalyst.perl.org
Wed Dec 12 15:34:32 GMT 2007
Author: purge
Date: 2007-12-12 15:34:32 +0000 (Wed, 12 Dec 2007)
New Revision: 7285
Modified:
trunk/examples/CatalystAdvent/root/2007/pen/5.pod
Log:
another helper
Modified: trunk/examples/CatalystAdvent/root/2007/pen/5.pod
===================================================================
--- trunk/examples/CatalystAdvent/root/2007/pen/5.pod 2007-12-12 03:32:42 UTC (rev 7284)
+++ trunk/examples/CatalystAdvent/root/2007/pen/5.pod 2007-12-12 15:34:32 UTC (rev 7285)
@@ -84,19 +84,25 @@
=head2 Useful code snippets
You could add these in your root controller to make them available for all your actions.
-(thanks zamolxes!)
sub action_uri {
my ($c, $controller, $action, @params) = @_;
return $c->uri_for($c->controller($controller)->action_for($action), @params);
}
+ (thanks zamolxes!)
sub redirect_to_action {
my ($c, $controller, $action, @params) =@_;
$c->response->redirect($c->uri_for($c->controller($controller)->action_for($action), @params));
$c->detach;
}
-
+ (thanks zamolxes!)
+
+ sub chained_uri_for {
+ my $c = shift;
+ return $c->uri_for($c->action,$c->req->captures, at _);
+ }
+
<a href="[% c.action_uri('Foo::Bar','baz',5) %]">BAZ!</a>
$c->redirect_to_action('User','login');
More information about the Catalyst-commits
mailing list