[Catalyst-dev] RFC: DWIM redirects

Jonathan Rockway jon at jrock.us
Sat Jan 6 16:58:56 GMT 2007


During a recent IRC conversation, the idea came up to implement a $c->redirect 
method that works like $c->forward.  It will accept an application path 
('/controller/action', etc.) and will immediately halt processing (like 
$c->detach('action')) but will issue an HTTP redirect to the uri_for the 
action.

Hence, we have:
$c->forward('action')
$c->detach('action')
$c->redirect('action')

which all behave similarly, i.e. transfer control to 'action'; and then:
$c->response->headers
$c->response->redirect

which behave similarly, i.e. set some flags and continue processing.

Everything fits together nicely (if you know how forward works, you'll know 
how redirect works), and it should be easy to implement without breaking any 
existing code.  Too good to be true, almost :)

Regards,
Jonathan Rockway

-- 
package JAPH;use Catalyst qw/-Debug/;($;=JAPH)->config(name => do {
$,.=reverse qw[Jonathan tsu rehton lre rekca Rockway][$_].[split //,
";$;"]->[$_].q; ;for 1..4;$,=~s;^.;;;$,});$;->setup;



More information about the Catalyst-dev mailing list