Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add DEVEL_COVER_IO_OPTIONS environment variable.

Set it to "pretty" to make readable JSON DB files.
  • Loading branch information...
commit 2f79f3e96e1ea6a7d88f7571f46f55b39f21bffe 1 parent a9d6071
@pjcj authored
Showing with 5 additions and 2 deletions.
  1. +5 −2 lib/Devel/Cover/DB/IO.pm
View
7 lib/Devel/Cover/DB/IO.pm
@@ -27,7 +27,8 @@ sub new
my $class = shift;
my $self =
{
- format => $Format,
+ format => $Format,
+ options => $ENV{DEVEL_COVER_IO_OPTIONS} || "",
@_
};
@@ -76,9 +77,11 @@ sub write
return $self;
}
+ my $json = JSON::PP->new->utf8;
+ $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 mailbox - $!\n";
- print $fh "", JSON::PP::encode_json($data); # "", for 5.6.1
+ print $fh $json->encode($data);
close $fh or die "Can't close $file: $!";
$self
}
Please sign in to comment.
Something went wrong with that request. Please try again.