From: Graham Knop Date: Sat, 4 Feb 2017 06:50:56 +0000 (-0500) Subject: support Cpanel::JSON::XS and JSON::MaybeXS X-Git-Tag: v0.28~5 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=837fdc4c1b81b0032be8cf1c06e0a13f4e153133;p=p5sagit%2FConfig-Any.git support Cpanel::JSON::XS and JSON::MaybeXS --- diff --git a/lib/Config/Any/JSON.pm b/lib/Config/Any/JSON.pm index 785f396..81cbaf8 100644 --- a/lib/Config/Any/JSON.pm +++ b/lib/Config/Any/JSON.pm @@ -50,7 +50,15 @@ sub load { my $content = do { local $/; <$fh> }; close $fh; - if ( eval { require JSON::DWIW } ) { + if ( eval { require Cpanel::JSON::XS } ) { + my $decoder = Cpanel::JSON::XS->new->utf8->relaxed; + return $decoder->decode( $content ); + } + elsif ( eval { require JSON::MaybeXS } ) { + my $decoder = JSON::MaybeXS::JSON()->new->utf8->relaxed; + return $decoder->decode( $content ); + } + elsif ( eval { require JSON::DWIW } ) { my $decoder = JSON::DWIW->new; my ( $data, $error ) = $decoder->from_json( $content ); die $error if $error;