[Catalyst] Can't seem to use forward or detach. Any
	special	requirements?
    Tomas Doran 
    bobtfish at bobtfish.net
       
    Wed Apr 29 12:36:46 GMT 2009
    
    
  
kakimoto at tpg.com.au wrote:
>   The app works fine except that I have set up an eval block within my
> controller.
>   My detach call comes right after the redirect call.
> 
>   It looks like this:
> 
>             $c->res->redirect($c->uri_for('/users/subscriptions/added '));
>             $c->detach ();
> 
>    What's weird is that on my terminal, the catalyst debug messages
> extract reads:
> 
> [debug] User subscription (id, 1278) updated in database.
> [debug]  update: trapped exception - catalyst_detach
>  
>    Any idea as to what this means?
$c->detach works by throwing an exception, whos contents are 
$Catalyst::DETACH (which is the string 'catalyst_detach').
Therefore, if you call $c->detach inside an eval block of your own, then 
you'll end up catching the exception, which is, I guess, what is 
happening here.
Don't do that :)
Call $c->detach outside of your eval block and Catalyst will catch the 
exception, and everything will be fine.
Another thought - what does $c->detach() do / what do you expect it to 
do? If you aren't detaching _to somewhere_, then why not just return?
Cheers
t0m
    
    
More information about the Catalyst
mailing list