Open jwrightecs opened 5 years ago
So really that constant name means use JSON XS instead of a pure perl module, which would correspond to Cpanel::JSON::XS
in this module (maybe this is a confusing name since there is a JSON::XS
). I didn't use JSON::MaybeXS and chose to do this due to the problems listed here on Cpanel::JSON::XS
for why it was forked from JSON::XS
:
https://metacpan.org/pod/Cpanel::JSON::XS#cPanel-fork
It is possible to pass in a JSON::XS
object to use as the encoder if needed:
my $ref = slurp_json 'ref.json', JSON::XS->new;
Or
my $json_slurper = JSON::Slurper->new(encoder => JSON::XS->new);
The constant is "JSON_XS", but that module isn't checked. Perhaps JSON::MaybeXS, which uses Cpanel::JSON::XS, with fallbacks to JSON::XS then JSON::PP, should be used instead.