Raisin icon indicating copy to clipboard operation
Raisin copied to clipboard

Regex check in Raisin::Entity flags numbers as strings for JSON::XS

Open m-dango opened this issue 4 years ago • 0 comments

Raisin::Entity::_compile_column contains the following check on an entity runtime return value:

$retval && !ref($retval) && $retval =~ /^Raisin::Entity::Nested::/

The checks on $retval unfortunately means that any non-zero value returned as a number from the runtime will be output as a string in JSON, due to the regex, if the user happens to be using JSON::XS.

Raisin example: https://replit.com/@m-dango/RaisinNumericString#main.pl

Comparing resulting JSON across different modules: https://replit.com/@m-dango/jsonNumberRegex#main.pl

m-dango avatar Oct 22 '21 22:10 m-dango