LunarCowgirl has asked for the wisdom of the Perl Monks concerning the following question:
I'm having problems using DBIxResultSet in Catalyst, and I haven't been able to solve the issue. I'm sure it's something simple, but I'm fairly new to using both, so it's not obvious to me, and I've exhausted all the search results to no avail. I get the following error message:
"Can't locate object method "next" via package "DBIx::ResultSet"
The manual says:
"There's likely a syntax error in the table class referred to elsewhere in this error message. In particular make sure that the package declaration is correct, so for a schema MySchema you need to specify a fully qualified namespace: package MySchema::MyTable; for example."
There's no table class referred to in the message though, and all the package declarations appear to be correct.
I have a ResultSet class that is basically copied and pasted from the docs:
package AppName::Model::DBIxResultSet; use Moose; use namespace::autoclean; extends 'Catalyst::Model::DBIxResultSet'; __PACKAGE__->config( dsn => 'dbi:SQLite:data/appname.db', user => '', password => '', on_connect_do => q{PRAGMA foreign_keys = ON}, ); __PACKAGE__->meta->make_immutable; 1;
and I'm calling it in the same way as in the docs, using DBIx::Class::ResultClass::HashRefInflator though:
my $model = $c->model('DBIxResultSet'); my $rs = $model->resultset('users')->search({}, {order_by => 'num DESC +', rows => 10, result_class => 'DBIx::Class::ResultClass::HashRefInfl +ator'}); while (my $user = $rs->next) { # code }
Anything I try to do that involves calling a ResultSet method brings the same type of error message. If anyone could point me in the right direction, I'd be appreciative. I've only found a few issues such as this when searching, and none of the solutions have been relevant.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Problems using DBIxResultSet in Catalyst
by Anonymous Monk on Aug 14, 2014 at 06:55 UTC | |
by LunarCowgirl (Sexton) on Aug 14, 2014 at 19:44 UTC |