Subject: | JSON->VERSION returns undef with default backend |
After upgrading JSON from 2.90 to 2.93, JSON->VERSION call returns undef instead of a version value. I bisected the breaking commit to:
commit 9025223ca90482db122ea6dea2df7f6715aa0cd4 (HEAD, refs/bisect/bad)
Author: Kenichi Ishigaki <ishigaki@cpan.org>
Date: Fri May 19 04:04:25 2017 +0900
add VERSION method to JSON::Backend packages to show VERSION of the actual backend module (JSON::XS, JSON::PP etc), for backward compatibility
Before:
$ perl -Ilib -e 'use Data::Dumper; use JSON; JSON->VERSION; print Data::Dumper::Dumper(JSON->VERSION)'
$VAR1 = '2.92';
After (I have not other JSON implentations installed):
$ perl -Ilib -e 'use Data::Dumper; use JSON; JSON->VERSION; print Data::Dumper::Dumper(JSON->VERSION)'
$VAR1 = undef;
This breaks JSON detection used in CGI-Ex-2.44:
if (JSON->VERSION > 1.98) {
my $j = JSON->new;
$j->canonical(1);
$j->pretty;
$str = $j->encode($ref);
} else {
$str = JSON->new->objToJSon($ref, {pretty => 1, indent => 2});
}
I can see you changed the VERSION method to return version of the actual backend. Should then users use JSON->can('encode') instead of checking JSON->VERSION?