[Dbix-class] DBIX to JSON
David Dorward
david at dorward.me.uk
Wed Jan 7 21:04:35 GMT 2009
fREW Schmidt wrote:
> I am trying to figure out how to get some JSON with dbic and I am not
> really sure what I am doing wrong.
When I wanted to do that, I took an entirely different approach.
My module for the table includes a TO_JSON subroutine (as specified by
the JSON::XS module):
http://github.com/dorward/simple-ajax-demo/tree/master/lib/App/SimpleAjaxDemo/DB/Twitter.pm#L30
Then I perform a query:
http://github.com/dorward/simple-ajax-demo/tree/master/webroot/demo.pl#L42
Put the results into my data structure:
http://github.com/dorward/simple-ajax-demo/tree/master/webroot/demo.pl#L49
And convert to JSON:
http://github.com/dorward/simple-ajax-demo/tree/master/webroot/demo.pl#L53
--
David Dorward <http://dorward.me.uk/>
More information about the DBIx-Class
mailing list