Skip to content

Commit

Permalink
s/JSON::XS/Cpanel::JSON::XS/
Browse files Browse the repository at this point in the history
  • Loading branch information
oalders committed Nov 11, 2015
1 parent 9b8fb0e commit 9e0145d
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 16 deletions.
2 changes: 1 addition & 1 deletion bin/check_json.pl
Expand Up @@ -3,7 +3,7 @@
use 5.010;

use Data::Dumper;
use JSON::XS;
use Cpanel::JSON::XS;

foreach my $file ( @ARGV ) {
say "Processing $file";
Expand Down
2 changes: 1 addition & 1 deletion bin/get_fields.pl
@@ -1,7 +1,7 @@
#!/usr/bin/env perl
# PODNAME: get_fields.pl
use Data::Dumper;
use JSON::XS;
use Cpanel::JSON::XS;
use File::Find::Rule;
use File::Basename;
use Path::Class;
Expand Down
2 changes: 1 addition & 1 deletion cpanfile
Expand Up @@ -73,7 +73,7 @@ requires 'IO::String';
requires 'IO::Uncompress::Bunzip2';
requires 'IO::Zlib';
requires 'IPC::Run3';
requires 'JSON::XS', '3.01';
requires 'Cpanel::JSON::XS', '3.0115';
requires 'JSON', '2.90';
requires 'LWP::Protocol::https';
requires 'LWP::UserAgent';
Expand Down
4 changes: 2 additions & 2 deletions elasticsearch/cpanratings.pl
Expand Up @@ -31,7 +31,7 @@
use List::Util qw(sum);
use WWW::Mechanize::Cached;
use HTML::TokeParser::Simple;
use JSON::XS;
use Cpanel::JSON::XS;
use Parse::CSV;
use Path::Class::File;
use feature 'say';
Expand Down Expand Up @@ -212,7 +212,7 @@ sub mean {
sub dump_json
{
my $hash_data = shift;
my $coder = JSON::XS->new->ascii->pretty->allow_nonref;
my $coder = Cpanel::JSON::XS->new->ascii->pretty->allow_nonref;
my $json = $coder->utf8->encode ($hash_data);
#binmode(STDOUT, ":utf8");
return $json;
Expand Down
4 changes: 2 additions & 2 deletions lib/MetaCPAN/Script/Author.pm
Expand Up @@ -10,7 +10,7 @@ use DateTime::Format::ISO8601 ();
use Email::Valid ();
use Encode ();
use File::stat ();
use JSON::XS ();
use Cpanel::JSON::XS ();
use Log::Contextual qw( :log );
use MetaCPAN::Document::Author;
use URI ();
Expand Down Expand Up @@ -113,7 +113,7 @@ sub author_config {
return undef;
}
my $json = $file->slurp;
my $author = eval { JSON::XS->new->utf8->relaxed->decode($json) };
my $author = eval { Cpanel::JSON::XS->new->utf8->relaxed->decode($json) };

if ($@) {
log_warn {"$file is broken: $@"};
Expand Down
2 changes: 1 addition & 1 deletion lib/MetaCPAN/Script/Backup.pm
Expand Up @@ -7,7 +7,7 @@ use feature qw( state );
use Data::Printer;
use DateTime;
use IO::Zlib ();
use JSON::XS;
use Cpanel::JSON::XS;
use Log::Contextual qw( :log :dlog );
use MetaCPAN::Types qw( Bool Int Str File );
use Moose;
Expand Down
2 changes: 1 addition & 1 deletion lib/MetaCPAN/Script/Mirrors.pm
Expand Up @@ -24,7 +24,7 @@ sub index_mirrors {

my $json = $self->cpan->file( 'indices', 'mirrors.json' )->slurp;
my $type = $self->index->type('mirror');
my $mirrors = JSON::XS::decode_json($json);
my $mirrors = Cpanel::JSON::XS::decode_json($json);
foreach my $mirror (@$mirrors) {
$mirror->{location}
= { lon => $mirror->{longitude}, lat => $mirror->{latitude} };
Expand Down
5 changes: 3 additions & 2 deletions lib/MetaCPAN/Script/Query.pm
Expand Up @@ -4,7 +4,7 @@ use strict;
use warnings;

use Data::DPath qw(dpath);
use JSON::XS;
use Cpanel::JSON::XS;
use Moose;
use MooseX::Aliases;
use YAML::Syck qw(Dump);
Expand Down Expand Up @@ -40,7 +40,8 @@ sub run {
}
);
my @results = dpath($path)->match( decode_json($json) );
( my $dump = Dump(@results) ) =~ s/\!\!perl\/scalar:JSON::XS::Boolean //g;
( my $dump = Dump(@results) )
=~ s/\!\!perl\/scalar:Cpanel::JSON::XS::Boolean //g;
print $dump;

}
Expand Down
2 changes: 1 addition & 1 deletion lib/MetaCPAN/Script/Release.pm
Expand Up @@ -4,7 +4,7 @@ use strict;
use warnings;

BEGIN {
$ENV{PERL_JSON_BACKEND} = 'JSON::XS';
$ENV{PERL_JSON_BACKEND} = 'Cpanel::JSON::XS';
}

use CPAN::DistnameInfo ();
Expand Down
2 changes: 1 addition & 1 deletion lib/MetaCPAN/Script/Watcher.pm
Expand Up @@ -4,7 +4,7 @@ use strict;
use warnings;

use CPAN::DistnameInfo;
use JSON::XS;
use Cpanel::JSON::XS;
use Log::Contextual qw( :log );
use MetaCPAN::Util;
use Moose;
Expand Down
6 changes: 3 additions & 3 deletions lib/MetaCPAN/Server/View/JSON.pm
Expand Up @@ -3,7 +3,7 @@ package MetaCPAN::Server::View::JSON;
use strict;
use warnings;

use JSON::XS;
use Cpanel::JSON::XS;
use Moose;

extends 'Catalyst::View::JSON';
Expand All @@ -14,8 +14,8 @@ sub encode_json($) {
my ( $self, $c, $data ) = @_;
my $encoder
= $c->req->looks_like_browser
? JSON::XS->new->utf8->pretty
: JSON::XS->new->utf8;
? Cpanel::JSON::XS->new->utf8->pretty
: Cpanel::JSON::XS->new->utf8;
$encoder->encode( exists $data->{rest} ? $data->{rest} : $data );
}

Expand Down

0 comments on commit 9e0145d

Please sign in to comment.