[Dbix-class] DBIX to JSON
fREW Schmidt
frioux at gmail.com
Wed Jan 7 20:53:30 GMT 2009
Hi!
I am trying to figure out how to get some JSON with dbic and I am not really
sure what I am doing wrong. Here is my test code:
# various setup stuff is up here
...
# and to get some sweet, delicious JSON
$rs =3D $schema->resultset('Shop');
use DBIx::Class::ResultClass::HashRefInflator;
$rs =3D $rs->search({
AgentRequestedLast =3D> {'LIKE', 'Dy%'},
},{
rows =3D> 10,
order_by =3D> ['AgentRequestedLast', 'AgentRequestedFirst', 'ShopNo
DESC'],
columns =3D> qw/AgentRequestedLast AgentRequestedFirst ShopNo/
});
$rs->result_class('DBIx::Class::ResultClass::HashRefInflator');
my $data =3D {data=3D>[]};
while (my $shop =3D $rs->next() ) {
push @{$data->{data}}, $shop;
}
say to_json($data);
I then get the error: Can't use string AgentRequestedLast as an ARRAY ref
while in strict refs.
What am I doing incorrectly?
-- =
-fREW
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20090107/852=
28aa1/attachment.htm
More information about the DBIx-Class
mailing list