[Dbix-class] Getting numeric columns as numeric values

Tim Bunce Tim.Bunce at pobox.com
Thu Feb 26 08:57:27 GMT 2015


On Wed, Feb 25, 2015 at 01:15:12PM -0800, Augustus Saunders wrote:
> For reasons unknown to us, DBIx is stringifying numeric values somewhere along the way.

In addition to the other points made on this thread...

When working on WebAPI::DBIC I found that Cpanel::JSON::XS was the only
JSON serializer to handle dual-vars (eg stringified numbers) correctly.

Per https://metacpan.org/pod/Cpanel::JSON::XS#cPanel-fork

    "fixed encode of numbers for dual-vars. Different string
    representations are preserved, but numbers with temporary strings
    which represent the same number are here treated as numbers,
    not strings. Cpanel::JSON::XS is a bit slower, but preserves
    numeric types better."

So WebAPI::DBIC now requires Cpanel::JSON::XS.

Tim.



More information about the DBIx-Class mailing list