diff options
Diffstat (limited to 'Master/tlpkg/tlperl/site/lib/JSON/MaybeXS.pm')
-rwxr-xr-x | Master/tlpkg/tlperl/site/lib/JSON/MaybeXS.pm | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/Master/tlpkg/tlperl/site/lib/JSON/MaybeXS.pm b/Master/tlpkg/tlperl/site/lib/JSON/MaybeXS.pm index 302b01cb65a..88dd2c56670 100755 --- a/Master/tlpkg/tlperl/site/lib/JSON/MaybeXS.pm +++ b/Master/tlpkg/tlperl/site/lib/JSON/MaybeXS.pm @@ -4,19 +4,19 @@ use strict; use warnings FATAL => 'all'; use base qw(Exporter); -our $VERSION = '1.004000'; -$VERSION = eval $VERSION; +our $VERSION = '1.004003'; +$VERSION =~ tr/_//d; sub _choose_json_module { return 'Cpanel::JSON::XS' if $INC{'Cpanel/JSON/XS.pm'}; - return 'JSON::XS' if $INC{'JSON/XS.pm'}; + return 'JSON::XS' if $INC{'JSON/XS.pm'} && eval { JSON::XS->VERSION(3.0); 1 }; my @err; return 'Cpanel::JSON::XS' if eval { require Cpanel::JSON::XS; 1; }; push @err, "Error loading Cpanel::JSON::XS: $@"; - return 'JSON::XS' if eval { require JSON::XS; 1; }; + return 'JSON::XS' if eval { require JSON::XS; JSON::XS->VERSION(3.0); 1; }; push @err, "Error loading JSON::XS: $@"; return 'JSON::PP' if eval { require JSON::PP; 1 }; @@ -121,7 +121,8 @@ JSON::MaybeXS - Use L<Cpanel::JSON::XS> with a fallback to L<JSON::XS> and L<JSO =head1 DESCRIPTION This module first checks to see if either L<Cpanel::JSON::XS> or -L<JSON::XS> is already loaded, in which case it uses that module. Otherwise +L<JSON::XS> (at at least version 3.0) +is already loaded, in which case it uses that module. Otherwise it tries to load L<Cpanel::JSON::XS>, then L<JSON::XS>, then L<JSON::PP> in order, and either uses the first module it finds or throws an error. @@ -205,6 +206,8 @@ Since this is a bare sub in the various backend classes, it cannot be called as a class method like the other interfaces; it must be called as a function, with no invocant. It supports the representation used in all JSON backends. +Available since version 1.002004. + =head1 CONSTRUCTOR =head2 new |