Skip to content
Browse files

Merge branch 'master' of git://github.com/pjcj/Devel--Cover

  • Loading branch information...
2 parents dee6c37 + 43fae73 commit 45ca8f864450f69d6525e3b85249e9d4be5b1c1b @maspalio maspalio committed
Showing with 11 additions and 10 deletions.
  1. +3 −3 Makefile.PL
  2. +1 −0 dist.ini
  3. +4 −4 lib/Devel/Cover/DB/IO.pm
  4. +3 −3 lib/Devel/Cover/DB/IO/JSON.pm
View
6 Makefile.PL
@@ -164,11 +164,11 @@ Storable is required to store the coverage database. You can download
Storable from CPAN.
EOM
-check "JSON::PP", <<EOM;
-JSON::PP is required to store the coverage database in a portable format.
+check "JSON", <<EOM;
+JSON is required to store the coverage database in a portable format.
This is necessary in order to merge coverage data from incompatible systems.
Storing the database in a portable format will not be available until you
-install JSON::PP. In the meantime you may continue to use the rest of
+install JSON. In the meantime you may continue to use the rest of
Devel::Cover.
EOM
View
1 dist.ini
@@ -48,6 +48,7 @@ Pod::Coverage = 0.06
Pod::Coverage::CountParents = 0
Parallel::Iterator = 0
JSON::PP = 0
+JSON::XS = 0
Test::Differences = 0 ; make sure it gets added
[Prereqs / ConfigureRequires]
ExtUtils::MakeMaker = 0
View
8 lib/Devel/Cover/DB/IO.pm
@@ -16,11 +16,11 @@ my $Format;
BEGIN
{
- $Format = "Storable" if eval "use Storable; 1";
+ $Format = "JSON" if eval "use JSON; 1";
+ # warn "JSON available\n" if $INC{"JSON.pm"};
+ $Format = "Storable" if !$Format and eval "use Storable; 1";
# warn "Storable available\n" if $INC{"Storable.pm"};
- $Format = "JSON" if eval "use JSON::PP; 1";
- # warn "JSON::PP available\n" if $INC{"JSON/PP.pm"};
- die "Can't load either JSON::PP or Storable" unless $Format;
+ die "Can't load either JSON or Storable" unless $Format;
}
sub new
View
6 lib/Devel/Cover/DB/IO/JSON.pm
@@ -11,7 +11,7 @@ use strict;
use warnings;
use Fcntl ":flock";
-use JSON::PP;
+use JSON;
# VERSION
@@ -30,7 +30,7 @@ sub read
open my $fh, "<", $file or die "Can't open $file: $!";
flock($fh, LOCK_SH) or die "Cannot lock file: $!\n";
local $/;
- my $data = JSON::PP::decode_json(<$fh>);
+ my $data = JSON::decode_json(<$fh>);
close $fh or die "Can't close $file: $!";
$data
}
@@ -40,7 +40,7 @@ sub write
my $self = shift;
my ($data, $file) = @_;
- my $json = JSON::PP->new->utf8->allow_blessed;
+ my $json = JSON->new->utf8->allow_blessed;
$json->ascii->pretty->canonical if $self->{options} =~ /\bpretty\b/i;
open my $fh, ">", $file or die "Can't open $file: $!";
flock($fh, LOCK_EX) or die "Cannot lock file: $!\n";

0 comments on commit 45ca8f8

Please sign in to comment.
Something went wrong with that request. Please try again.