[Dbix-class] DBIx::Class::ResultClass::HashRefInflator and JSON::XS expanding numbers as strings

Robert Rothenberg robrwo at gmail.com
Fri Mar 15 09:48:13 GMT 2013


I have a PostgreSQL database that I run queries on, then use

  $rs->result_class('DBIx::Class::ResultClass::HashRefInflator');

and send [ $rs->all ] to JSON::XS for serialization in a RESTful interface.

It works well, except that numeric values are being translated into strings
instead of numbers.

This doesn't happen with integers, because I cast the column as "::int" and
the system just does the right thing.  But when I cast numeric columns as
"::numeric", they still come out as strings.

I'm at the point where I want to write my own HashRefInflator, but I don't
understand what arguments the inflate_result method expects.



More information about the DBIx-Class mailing list