Following up on what tobyink and 1nickt said, in a recent distribution I wrote, I let the compiler decide whether to use JSON (XS) or JSON::PP which is already in the core. If JSON is not installed, it'll automatically fall back to the core JSON::PP.
BEGIN { # look for JSON::XS, and if not available, fall # back to JSON::PP to avoid requiring non-core modules my $json_ok = eval { require JSON::XS; JSON::XS->import; 1; }; if (! $json_ok){ require JSON::PP; JSON::PP->import; } }
In reply to Re: Can not use JSON module
by stevieb
in thread Can not use JSON module
by tejD
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |