Mailing List Archive

problem with DBIx, Catalyst and PostgreSQL
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: problem with DBIx, Catalyst and PostgreSQL [ In reply to ]
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 <fluca1978@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/