[Catalyst] $c->res->redirect and $c->detach

John Napiorkowski jjn1056 at yahoo.com
Tue Sep 19 01:06:33 CEST 2006


--- Bogdan Lucaciu <bogdan at wiz.ro> wrote:

> On Mon, 2006-09-18 at 15:44 -0700, John Napiorkowski
> wrote:
> > > >
> > > > Doing a $c->detach('/end') after the redirect
> was
> > > > suggested to me, although I find this can give
> an
> > > > error since my default end action looks for a
> > > template
> > > > which is this case doesn't exist.
> > > >
> 
> Using the DefaultEnd plugin or the RenderView action
> class will handle
> redirects for you.
> 
> Snip from thei source of
> Catalyst::Action::RenderView:
> 	return 1 if $c->response->status =~
> /^(?:204|3\d\d)$/;
> 
> more info:
>
http://search.cpan.org/~mramberg/Catalyst-Action-RenderView-0.04/lib/Catalyst/Action/RenderView.pm
> 
> You still have to do the detach , of course.

So I guess I do the redirect first and then detach
to end and let the renderview action just do the right
thing.  Seems easy enough I'll just have to remember
that redirects work this way.  I'm still used to doing
things in apache mod_perl where I'd set the location
header and return a redirect code and that was it. 
But this is good too.  Thanks!

--john

> 
> 
> -- 
> Bogdan Lucaciu <bogdan at wiz.ro>
> 
> 
> _______________________________________________
> List: Catalyst at lists.rawmode.org
> Listinfo:
> http://lists.rawmode.org/mailman/listinfo/catalyst
> Searchable archive:
>
http://www.mail-archive.com/catalyst@lists.rawmode.org/
> Dev site: http://dev.catalyst.perl.org/
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the Catalyst mailing list