[Catalyst-dev] RFC: DWIM redirects

Ash Berlin ash_cpan at firemirror.com
Sat Jan 6 17:26:14 GMT 2007


Jonathan Rockway wrote:
> 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
> 

Except what do you do when $c->redirect('/my/regexp_action') comes up? ;)



More information about the Catalyst-dev mailing list