[Dancer-users] Return after redirect

Juan J. Martínez reidrac at usebox.net
Fri Apr 9 14:09:07 UTC 2010


Eh, it's because of the empty body.

redirect '/';
return 'Redirecting...';

It's OK.

Cheers,

Juanjo

El vie, 09-04-2010 a las 15:04 +0100, Juan J. Martínez escribió:
> Hello,
> 
> Sometimes I need to redirect to another page after testing things, and I
> want to leave the route ASAP, so I do something like:
> 
> get '/test' => sub {
>   if(params->{whatever})
>   {
>     redirect '/';
>     return;
>   }
> 
>   "Other stuff, blah";
> };
>  
> get '/' => sub {
>   template 'index';
> };
> 
> I've switched to the dev branch, and that return after the redirect
> results in following error:
> 
> Use of uninitialized value $line in length
> at ../local/HTTP/Server/Simple/PSGI.pm line 137.
> 
> My question is: am I doing it right using return to leave the handler?
> 
> Cheers,
> 
> Juanjo
> 

-- 
jjm's home: http://www.usebox.net/jjm/
blackshell: http://blackshell.usebox.net/
 ramble on: http://rambleon.usebox.net/




More information about the Dancer-users mailing list