--- Robert 'phaylon' Sedlacek <[EMAIL PROTECTED]> wrote:
> John Napiorkowski said: > > I have a controller with some chained actions. > One of > > the actions (not an endpoint) will redirect given > a > > certain value for the arguments. However I find > that > > this doesn't stop the chain from completing. I > still > > get a line about the redirect in the log, but the > > endpoint in that chain still activates. > > > > I find that this doesn't happen when I use > $c->detach, > > although in this circumstance detach is not the > best > > use for me. > > Of course, redirect and detach/foward are completely > different. While > redirect may seem like "external detach," it isn't. > A redirect is an > answer to the browser, telling him to look up > another site. A forward or > detach moves the execution to another action. If you > call redirect, it > will just set the appropriate headers. It can't just > stop there, because > you might want to change those headers or do > something else before the > redirect (E.g. Setting a message in the flash). > > > Has anyone run into this before and found a way > around > > it? > > See Ash's answer, if you want to detach, detach :) > (Note that detach can > also be called without arguments at all, just ending > the execution). > > hth, > Robert I guess I am still used to how in mod_perl I'd just return a status code when I wanted to break execution and hadn't figured out the best way to do that in Catalyst. I didn't know you could detach without an arg. That sounds like want I want. I have to think I'm not the only one with this confusion. Maybe we could alias $c->end to $c->detach or something to make it clear in the docs how to stop the execution right away? Or even a $c->response->redirect_and_end() could do it. I mean most of the time when you redirect what you are looking for is catalyst to stop right there (at least for me but I can see reasons why you might want it to continue for logging and so forth). I think it's intuitive to think that dire I suppose it could be a trivial plugin as well. Thanks for the suggestions. I see there's a new Cat out, time to update! --john __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com _______________________________________________ List: [email protected] Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[email protected]/ Dev site: http://dev.catalyst.perl.org/
