Skip to content
This repository was archived by the owner on Jun 1, 2023. It is now read-only.

Commit 5d6c00b

Browse files
author
Reini Urban
committed
JSON-PP 2.27400_02: Fixed true/false redefinition
no warnings, take the existing values from Cpanel::JSON::XS or JSON::XS.
1 parent 495bfbf commit 5d6c00b

File tree

6 files changed

+27
-12
lines changed

6 files changed

+27
-12
lines changed

Porting/Maintainers.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,7 @@ package Maintainers;
854854
'JSON::PP' => {
855855
'DISTRIBUTION' => 'MAKAMAKA/JSON-PP-2.27400.tar.gz',
856856
'FILES' => q[cpan/JSON-PP],
857-
# fallback to Cpanel::JSON::XS
857+
# fallback to Cpanel::JSON::XS, fixed Boolean
858858
'CUSTOMIZED' => [ qw( lib/JSON/PP.pm )],
859859
},
860860

cpan/JSON-PP/lib/JSON/PP.pm

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use Carp ();
1111
use B ();
1212
#use Devel::Peek;
1313

14-
$JSON::PP::VERSION = '2.27400';
14+
$JSON::PP::VERSION = '2.27400_02'; # _01 taken by 5.25.4
1515

1616
@JSON::PP::EXPORT = qw(encode_json decode_json from_json to_json);
1717

@@ -1388,20 +1388,31 @@ BEGIN {
13881388

13891389

13901390
# shamelessly copied and modified from JSON::XS code.
1391-
1392-
$JSON::PP::true = do { bless \(my $dummy = 1), 'JSON::PP::Boolean' };
1393-
$JSON::PP::false = do { bless \(my $dummy = 0), 'JSON::PP::Boolean' };
1391+
BEGIN {
1392+
if ($INC{'Cpanel/JSON/XS.pm'}) {
1393+
$JSON::PP::true = $Cpanel::JSON::true;
1394+
$JSON::PP::false = $Cpanel::JSON::false;
1395+
} elsif ($INC{'JSON/XS.pm'}
1396+
and $INC{'Types/Serialiser.pm'}
1397+
and $JSON::XS::VERSION ge "3.00")
1398+
{
1399+
$JSON::PP::true = $Types::Serialiser::true; # readonly if loaded by JSON::XS
1400+
$JSON::PP::false = $Types::Serialiser::false;
1401+
} else {
1402+
$JSON::PP::true = do { bless \(my $dummy = 1), "JSON::PP::Boolean" };
1403+
$JSON::PP::false = do { bless \(my $dummy = 0), "JSON::PP::Boolean" };
1404+
}
1405+
}
13941406

13951407
sub is_bool($) {
13961408
shift if @_ == 2; # as method call
13971409
(ref($_[0]) and UNIVERSAL::isa( $_[0], 'JSON::PP::Boolean'))
13981410
or (exists $INC{'Types/Serializer.pm'} and Types::Serialiser::is_bool($_[0]))
13991411
}
14001412

1401-
1402-
sub true { $JSON::PP::true }
1403-
sub false { $JSON::PP::false }
1404-
sub null { undef; }
1413+
sub true () { $JSON::PP::true }
1414+
sub false () { $JSON::PP::false }
1415+
sub null () { undef }
14051416

14061417
###############################
14071418

cpan/JSON-PP/lib/JSON/PP/Boolean.pm

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ L<JSON::PP> for more info about this class.
1414
=cut
1515

1616
use JSON::PP ();
17-
use strict;
1817

1918
1;
2019

dist/Module-CoreList/lib/Module/CoreList.pm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13369,6 +13369,7 @@ for my $version ( sort { version_sort($a, $b) } keys %released ) {
1336913369
'Time::Local' => '1.24',
1337013370
'parent' => '0.236',
1337113371
'Cpanel::JSON::XS' => '3.0218',
13372+
'JSON::PP' => '2.27400_02',
1337213373
'CPAN::Meta' => '2.150010c',
1337313374
'CPAN::Meta::Converter' => '2.150010',
1337413375
'CPAN::Meta::Feature' => '2.150010',

pod/perlcdelta.pod

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,10 @@ reformatted
458458
improved t/parent-pmc.t,
459459
excluded new xt tests
460460

461+
=item JSON::PP 2.27400_02
462+
463+
Fixed true/false redefinition warnings.
464+
461465
=back
462466

463467
=head1 Documentation

t/porting/customized.dat

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ File::Path cpan/File-Path/lib/File/Path.pm 623799e76e11a756ca5e18749d8bc1bdc3800
6161
File::Path cpan/File-Path/t/Path_win32.t 94b9276557ce7f80b91f6fd9bfa7a0cd9bf9683e
6262
File::Spec dist/PathTools/t/rel2abs_vs_symlink.t abbf1a890a1b6fefebc0c8a9e2849694ade89fa9
6363
IO::Socket::IP cpan/IO-Socket-IP/lib/IO/Socket/IP.pm fb1175286262913bec59482b84a3587ec48339ea
64-
JSON::PP cpan/JSON-PP/lib/JSON/PP.pm ea210ef037088b8ff77db8a0c149e09032a4beab
65-
Module::CoreList dist/Module-CoreList/lib/Module/CoreList.pm e56b4f5c3ddffe21bd712ba5f50c7abb3499382f
64+
JSON::PP cpan/JSON-PP/lib/JSON/PP.pm da7db2b7b06467019466d3d82f29bfdb6c5b0b49
65+
Module::CoreList dist/Module-CoreList/lib/Module/CoreList.pm 626fb1c196a9e5491df86c348f3b91d0894bdd93
6666
Module::CoreList dist/Module-CoreList/lib/Module/CoreList/Utils.pm c968b0977900360ef0cf739ee9f9c6be6ce91afc
6767
Module::Metadata cpan/Module-Metadata/t/lib/GeneratePackage.pm 502ffbe2609947430e6aa1a3df8064b3fef3e086
6868
Net::Domain cpan/libnet/lib/Net/Cmd.pm 70a007c38833667ad47ea8059c37c1b7d1c77b6c

0 commit comments

Comments
 (0)