[Catalyst] forward not working correctly ?

Octavian Rasnita orasnita at gmail.com
Thu Jan 29 19:11:47 GMT 2015


From: "Luca Ferrari" <fluca1978 at infinito.it>

> Hi all,
> I'm surely missing something in my action:
>
>
> sub edit : Local Form {
>    my ( $self, $c, $id ) = @_;
>    my $form = $self->formbuilder();
>
>   ...
>    if ( $is_form_ok ){
>        ...
>        $c->forward( 'list' );
>   } else {
>     ...
>   }
> }
>
>
> The result is that the same page (the form for the edit action) is
> always rendered, even if all the business logic works fine.
> detach is not working as I'm expecting too, and  only visit appears to
> render the list action, but without changing the url.


$c->forward() just calls another method, but in the same request. I think 
you want to use $c->redirect().

$c->redirect( $c->uri_for_action( ... ) );

--Octavian






More information about the Catalyst mailing list