Skip Menu |

This queue is for tickets about the JSON CPAN distribution.

Report information
The Basics
Id: 121892
Status: resolved
Priority: 0/
Queue: JSON

People
Owner: Nobody in particular
Requestors: ppisar [...] redhat.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 2.93
Fixed in: (no value)



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?
On Fri May 26 00:10:53 2017, ppisar wrote: Show quoted text
> 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?
Oops. I may have to add VERSION method to JSON namespace itself, too. Will look at it later. Thanks for spotting.
From: ppisar [...] redhat.com
Dne Čt 25.Květen.2017 11:10:53, ppisar napsal(a): Show quoted text
> This breaks JSON detection used in CGI-Ex-2.44: >
A posted CGI-Ex fix to CPAN RT#121893.
On Fri May 26 00:30:23 2017, ppisar wrote: Show quoted text
> Dne Čt 25.Květen.2017 11:10:53, ppisar napsal(a):
> > This breaks JSON detection used in CGI-Ex-2.44: > >
> A posted CGI-Ex fix to CPAN RT#121893.
Fixed and shipped 2.94. Thanks.