[Catalyst] How to redirect before some code excute

Lee Standen nom at standen.id.au
Wed Oct 25 08:56:51 BST 2006


It's a subroutine, right?

Tried a return?....such as:

$c->res->redirect('http://www.yahoo.com');
return undef;



fayland wrote:
> i want to redirect before the loop  excute , but it seems redirect 
> happens after the loop finish. is there any plugin or method to do this?
>
> my code
> .....
>
>    $c->res->redirect(' http://www.yahoo.com' <http://www.yahoo.com%27>);
>    my $n;
>    while($n<99999) {
>        $c->log->debug($n);
>        $n++;
>    }
>    $c->log->debug('asaaaaaaaaaaaa');
> ........ 
> of course. the while loop is faked. indeed it's something involved 
> with $c.
> the logic of Catalyst is run the whole sub over then call end. but I 
> want to print redirect to visitor then run the while in backend.
>
> is that clear enough?
> Thanks for help.
>




More information about the Catalyst mailing list