Closed charsbar closed 8 years ago
Can you describe or document how to use custom JSON module implementation with JSON.pm? I'm not able to understand it from referenced commit 966acfa.
Ok, now I found out how. E.g. Cpanel::JSON::XS can be loaded by:
BEGIN { $ENV{PERL_JSON_BACKEND} = "Cpanel::JSON::XS" };
use JSON 2.91_01;
...
Please reopen this ticket -- it is not possible to set PERL_JSON_BACKEND to any other module.
$ PERL_JSON_BACKEND=Cpanel::JSON::XS perl -MJSON -e1
The value of environmental variable 'PERL_JSON_BACKEND' is invalid. at -e line 0.
Compilation failed in require.
BEGIN failed--compilation aborted.
@karenetheridge VERSIONs of JSON and Cpanel::JSON::XS?
I saw this with perl 5.16.3, JSON 2.90, Cpanel::JSON::XS 3.0115.
I see that 2.91_01 added the ability to use more backends; sorry!
Any backend should be accepted, as long as it is compatible with JSON::XS/JSON::PP. It's also better to use JSON::Backend::(XS|PP) as a backend wrapper, instead of using the backend module directly, so that we don't need to care much about the name of the actual backend.
See also: https://rt.cpan.org/Ticket/Display.html?id=94784