Hello!

I've implemented

$c->uri_redirect($path) as a shortcut to $c->res->redirect($c->uri_for($path))

and

$c->uri_redirect_d($path) as $c->uri_redirect($path); $c->detach()

I guess these shortcuts are really useful. Patch is attached.

Alex.

--- Catalyst.pm.orig	2008-03-20 13:11:59.000000000 +0300
+++ Catalyst.pm	2008-03-20 13:15:10.000000000 +0300
@@ -2220,6 +2220,28 @@
 
 sub use_stats { 0 }
 
+=head2 $c->uri_recirect( $path )
+
+Is a shortcut to $c->response->redirect($c->uri_for($path))
+
+=cut
+
+sub uri_redirect {
+    my ($c, $path) = @_;
+    return $c->response->redirect($c->uri_for($path));
+}
+
+=head2 $c->uri_redirect_d( $path )
+
+Is a shortcut to $c->uri_redirect($path); $c->detach();
+
+=cut 
+
+sub uri_redirect_d {
+    my ($c, $path) = @_;
+    $c->uri_redirect($path);
+    $c->detach();
+}
 
 =head2 $c->write( $data )
 
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to