http://www.perlmonks.org?node_id=1213000

1nickt has asked for the wisdom of the Perl Monks concerning the following question:

Hi all,

My understanding is that using JSON will cause Perl to load JSON::XS or Cpanel::JSON::XS if they are installed. But my testing shows that JSON::PP is used:

$ perl -MJSON -e 1 $ perl -MJSON::XS -e 1 Can't locate JSON/XS.pm in @INC (you may need to install the JSON::XS +module) [...] BEGIN failed--compilation aborted. $ perl -MCpanel::JSON::XS -e 1 $ perl -MJSON -MData::Dumper -wE 'decode_json(qq{{"foo":"bar"}}); say +Dumper %INC;' | grep JSON $VAR33 = 'JSON/PP.pm'; $VAR34 = '/Users/ntonkin/perl5/perlbrew/perls/perl-5.26.1/lib/5.26.1/J +SON/PP.pm'; $VAR37 = 'JSON.pm'; $VAR38 = '/Users/ntonkin/.perlbrew/libs/perl-5.26.1@dev/lib/perl5/JSON +.pm';

Anything I have missed?


The way forward always starts with a minimal test.