4 use warnings FATAL => 'all';
12 if (eval { require Cpanel::JSON::XS; 1; }) {
13 $JSON_Class = 'Cpanel::JSON::XS';
15 push @err, "Error loading Cpanel::JSON::XS: $@";
16 if (eval { require JSON::PP; 1; }) {
17 $JSON_Class = 'JSON::PP';
19 push @err, "Error loading JSON::PP: $@";
22 unless ($JSON_Class) {
23 die join("\n", "Couldn't load a JSON module:", @err);
25 $JSON_Class->import(qw(encode_json decode_json));
28 our @EXPORT = qw(encode_json decode_json JSON);
30 sub JSON () { our $JSON_Class }