Open perlpunk opened 6 years ago
I just ran into this issue. Is the fix straightforward?
I'm not sure. I guess it should be easy. Currently this code is used:
scalar = newSVpvn(string, length);
SvIV_please(scalar);
https://github.com/ingydotnet/yaml-libyaml-pm/blob/master/LibYAML/perl_libyaml.c#L467 https://github.com/ingydotnet/yaml-libyaml-pm/blob/master/LibYAML/perl_libyaml.c#L563
Not sure which would be the correct function.
The good news is that the newest JSON::PP and Cpanel::JSON::XS default to number when both flags are set. But this should still be fixed here.
I'm not sure. I guess it should be easy. Currently this code is used:
scalar = newSVpvn(string, length); SvIV_please(scalar);
https://github.com/ingydotnet/yaml-libyaml-pm/blob/master/LibYAML/perl_libyaml.c#L467 https://github.com/ingydotnet/yaml-libyaml-pm/blob/master/LibYAML/perl_libyaml.c#L563
Not sure which would be the correct function.
I guess you need something along the lines of
if (looks_like_number(scalar)) {
if (SvNV(scalar) == SvIV(scalar))
SvIV_only(scalar);
else
SvNV_only(scalar);
}
Numbers loaded from YAML have a PV additionally to IV / NV. Modules like JSON::PP/XS don't recognize them as a number and put quotes around them: