Mailing List Archive

forward not working correctly ?
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.

The development server console provides me the call chain:
/workers/edit
-> /workers/list
/end
-> Smickets::View::HTML->process

I'm using TTSite as my view.
What am I missing?

Thanks,
Luca

_______________________________________________
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/
Re: forward not working correctly ? [ In reply to ]
Hi,

i guess you are confused by all the different type of redirects, forwards,
visits ...

After your explanation i think you want a HTTP-Redirect (
http://www.catalystframework.org/calendar/2007/13) / redirect_to_action

Please read about visit, go, forward and detach in the documentation:
​(​
http://search.cpan.org/~jjnapiork/Catalyst-Runtime-5.90082/lib/Catalyst.pm
)​
​



Mit freundlichem Gruß
Felix Ostmann

-----------------------------------------------------------
QE GmbH & Co. KG, Martinistraße 3, D-49080 Osnabrück
-----------------------------------------------------------
Tel.: +49 (0) 541 / 40666 0, Fax: +49 (0) 541 / 40666 22
Email: info@qe.de, Web: www.qe.de
-----------------------------------------------------------
AG Osnabrück - HRA 200252, Ust-IdNr.: DE814737310
-----------------------------------------------------------
Komplementärin: QE24 GmbH, AG Osnabrück - HRB 200359,
Geschäftsführer: Ansas Meyer, Firmensitz: Osnabrück
-----------------------------------------------------------

Die in dieser Email enthaltenen Informationen sind vertrau-
lich zu behandeln und ausschließlich für den Adressaten be-
stimmt. Jegliche Veröffentlichung, Verteilung oder sonstige
in diesem Zusammenhang stehende Handlung wird ausdrücklich
untersagt.

2015-01-29 16:17 GMT+01:00 Luca Ferrari <fluca1978@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.
>
> The development server console provides me the call chain:
> /workers/edit
> -> /workers/list
> /end
> -> Smickets::View::HTML->process
>
> I'm using TTSite as my view.
> What am I missing?
>
> Thanks,
> Luca
>
> _______________________________________________
> List: Catalyst@lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive:
> http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
>
Re: forward not working correctly ? [ In reply to ]
From: "Luca Ferrari" <fluca1978@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




_______________________________________________
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/
Re: forward not working correctly ? [ In reply to ]
CIao,

On Thu, Jan 29, 2015 at 6:28 PM, QE :: Felix Ostmann <ostmann@qe.de> wrote:
> Hi,
>
> i guess you are confused by all the different type of redirects, forwards,
> visits ...
>
> After your explanation i think you want a HTTP-Redirect
> (http://www.catalystframework.org/calendar/2007/13) / redirect_to_action
>
> Please read about visit, go, forward and detach in the documentation:
> (
> http://search.cpan.org/~jjnapiork/Catalyst-Runtime-5.90082/lib/Catalyst.pm
> )


Thanks, I was misleaded by a wrong example.

Luca

_______________________________________________
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/
Re: forward not working correctly ? [ In reply to ]
FWIW I highly recommend not using ->forward at all.  ->detach has some sort of reasonable use but all the other 'skip around the code' methods almost always end up with a huge mess.  
That stuff was semi useful prior to chained actions and Moose in controllers (for reusable roles).  At this point there is very little I'd use that stuff for.

On Thursday, January 29, 2015 9:18 AM, Luca Ferrari <fluca1978@infinito.it> wrote:


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.

The development server console provides me the call chain:
/workers/edit
-> /workers/list
/end
-> Smickets::View::HTML->process

I'm using TTSite as my view.
What am I missing?

Thanks,
Luca

_______________________________________________
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/