On 02/26/2015 09:57 AM, Tim Bunce wrote:
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."
Mojo::JSON does it as well. Fundamentally this is yet again a
performance tradeoff. The logic as seen from PP-space can be seen here:
https://github.com/kraih/mojo/blob/v5.82/lib/Mojo/JSON.pm#L255-L259
_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk