[dancer-users] return redirect vs return

David H untg99 at gmail.com
Tue Mar 17 23:46:46 GMT 2015


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.preshweb.co.uk/pipermail/dancer-users/attachments/20150318/095d8c29/attachment.html>


More information about the dancer-users mailing list