[Catalyst] forward not working correctly ?

2015-01-29 Thread Luca Ferrari
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: [Catalyst] forward not working correctly ?

2015-01-29 Thread QE :: Felix Ostmann
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: i...@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 fluca1...@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/

___
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: [Catalyst] problem with DBIx, Catalyst and PostgreSQL

2015-01-29 Thread Luca Ferrari
Oh what a shame!
Apologize for the noise, the model was 'Smickets::Worker' and not
'Smickets::Workes'.
I found out dumping the $c-model( 'Smickets' ) hash

Sorry for the noise.

Luca

On Thu, Jan 29, 2015 at 11:20 AM, Luca Ferrari fluca1...@infinito.it wrote:
 Hi all,
 I'm working on an application and I've a problem I cannot resolve.
 I've a postgresql database with a workers table, loggin of queries is on.
 I've created the schema with:

 % perl script/smickets_create.pl model SmicketsDB DBIC::Schema
 Smickets::Schema create=static dbi:Pg:dbname=smicketsdb username
 password

 and I've got the Result for the table Workers in
 lib/Smickers/Schema/Result/Workers.pm.
 So everything seems fine to me, but when in my controller I try to do:


 my $workers = $c-model( 'SmicketsDB::Workers' )-all();

 I got the following error:

 Caught exception in Smickets::Controller::Workers-list Can't call
 method all on an undefined value at
 /mnt/ada1a/sviluppo/Perl/Smickets/script/../lib/Smickets/Controller/Workers.pm
 line 35.

 I've checked that the database connection info is ok, and that the
 table contains some data. Moreover, I cannot see any query running
 against the database.
 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/


[Catalyst] problem with DBIx, Catalyst and PostgreSQL

2015-01-29 Thread Luca Ferrari
Hi all,
I'm working on an application and I've a problem I cannot resolve.
I've a postgresql database with a workers table, loggin of queries is on.
I've created the schema with:

% perl script/smickets_create.pl model SmicketsDB DBIC::Schema
Smickets::Schema create=static dbi:Pg:dbname=smicketsdb username
password

and I've got the Result for the table Workers in
lib/Smickers/Schema/Result/Workers.pm.
So everything seems fine to me, but when in my controller I try to do:


my $workers = $c-model( 'SmicketsDB::Workers' )-all();

I got the following error:

Caught exception in Smickets::Controller::Workers-list Can't call
method all on an undefined value at
/mnt/ada1a/sviluppo/Perl/Smickets/script/../lib/Smickets/Controller/Workers.pm
line 35.

I've checked that the database connection info is ok, and that the
table contains some data. Moreover, I cannot see any query running
against the database.
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: [Catalyst] forward not working correctly ?

2015-01-29 Thread Octavian Rasnita

From: Luca Ferrari fluca1...@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/