From: Brian Cassidy Date: Tue, 10 Sep 2013 18:38:35 +0000 (-0300) Subject: add JSON::PP to list of available JSON parsers (RT #86959) X-Git-Tag: v0.24~1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit%2FConfig-Any.git;a=commitdiff_plain;h=a8ffcd3bebfdfed41159d7ab3f48bb67082db773;hp=0026ed83b1e0520258a743cb5e69f3d0c2792105 add JSON::PP to list of available JSON parsers (RT #86959) --- diff --git a/Changes b/Changes index 8e3c213..31d2a07 100644 --- a/Changes +++ b/Changes @@ -2,6 +2,7 @@ Revision history for Config-Any 0.24 2013-09-10 - remove 4-year-old warning about YAML::XS not being installed + - add JSON::PP to list of available JSON parsers (RT #86959) 0.23 2011-07-13 - fix test suite's method of checking availability of plugins diff --git a/lib/Config/Any/JSON.pm b/lib/Config/Any/JSON.pm index ca2da3e..e8a1246 100644 --- a/lib/Config/Any/JSON.pm +++ b/lib/Config/Any/JSON.pm @@ -68,6 +68,12 @@ sub load { return JSON::Syck::Load( $content ); } + eval { require JSON::PP; JSON::PP->VERSION( 2 ); }; + unless( $@ ) { + my $decoder = JSON::PP->new->relaxed; + return $decoder->decode( $content ); + } + require JSON; eval { JSON->VERSION( 2 ); }; return $@ ? JSON::jsonToObj( $content ) : JSON::from_json( $content ); @@ -80,7 +86,7 @@ L or L in order to work. =cut -sub requires_any_of { 'JSON::DWIW', 'JSON::XS', 'JSON::Syck', 'JSON' } +sub requires_any_of { 'JSON::DWIW', 'JSON::XS', 'JSON::Syck', 'JSON::PP', 'JSON' } =head1 AUTHOR @@ -88,7 +94,7 @@ Brian Cassidy Ebricas@cpan.orgE =head1 COPYRIGHT AND LICENSE -Copyright 2006-2011 by Brian Cassidy +Copyright 2006-2013 by Brian Cassidy This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.