[Catalyst] Transferring control via root/auto

Andrew Rodland andrew at cleverdomain.org
Wed Dec 8 20:38:07 GMT 2010


On Wednesday, December 08, 2010 07:31:42 am Tomas Doran wrote:
> On 7 Dec 2010, at 16:11, Ben van Staveren wrote:
> > You want to $c->detach('end') -- unless that's the default these
> > days. I use this pattern a lot and the only difference I see is that
> 
> > I do:
> The end action will _always_ be run, there is no need to detach to the
> end action.
> 
> However I'm not sure what doing $c->detach in auto will do (I guess
> the same as returning 0 - i.e. stop further actions from running), but
> I'm not sure - you should probably return 0 (to stop further dispatch)
> rather than detaching in the auto action..

Since auto is internally just another step in _DISPATCH (Catalyst gets to it 
by calling forward and everything) detaching from it behaves as you'd expect 
-- the action you detach to is run, and so is end, and the current dispatch 
(including the rest of auto and running $c->action) is abandoned. So, possibly 
there are *cleaner* ways to deal with situations like that (often involving 
Chained), but if you want to do it, it shouldn't break on you.

Andrew



More information about the Catalyst mailing list