[dancer-users] return redirect vs return

Pedro Melo melo at simplicidade.org
Wed Mar 18 07:08:48 GMT 2015


Writing this from memory, but redirect doesn't abort the current request processing, so you need to return redirect on all places.

Sent from my iPhone

> On 17/03/2015, at 23:46, David H <untg99 at gmail.com> wrote:
> 
> So I had this question and I couldn't find any answer, since the two options were giving me confusion. I wanted t pass control off to another route if a certain action happened.
> 
> I had this in a route:
> if ($actionHappened) {
>    redirect '/CheckOffOrderItem/';
> }
> 
> and it was working fine, it would pass control off to that route and then any return would go to the page and return what I wanted.
> 
> I then went to add another line for something else below this one
> if ($theOtherThingHappened) {
>  redirect '/CheckOffProduct/'
> }
> 
> and it worked, about twice, then stopped working and wouldn't process the redirect, it would get to the condition and go through but just skip processing the route and continue with the existing route, so I read somewhere that "return redirect" should be used and not "redirect" when redirecting.
> 
> Is this true? and why?
> My top one is still working and hasn't stopped but I want to know what the logic behind these two are. When I changed the second one to 'return redirect' it started working again.
> 
> Thanks,
> 
> David Hancock
> _______________________________________________
> dancer-users mailing list
> dancer-users at dancer.pm
> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users


More information about the dancer-users mailing list