[Catalyst-dev] RFC: DWIM redirects

Matt S Trout dbix-class at trout.me.uk
Thu Jan 11 17:21:12 GMT 2007


On 6 Jan 2007, at 17:26, Ash Berlin wrote:

> 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? ;)

uri_for already mostly handles interpolating captures for regexp  
actions. I had fun writing that :)
-- 
Matt S Trout, Technical Director, Shadowcat Systems Ltd.
Offering custom development, consultancy and support contracts for  
Catalyst,
DBIx::Class and BAST. Contact mst (at) shadowcatsystems.co.uk for  
details.
+ Help us build a better perl ORM: http://dbix- 
class.shadowcatsystems.co.uk/ +





More information about the Catalyst-dev mailing list