Group
Extension

Matches 5

Devel-Cover ( P/PJ/PJCJ/Devel-Cover-1.51.tar.gz, PJCJ, 2025; MetaCPAN )
Devel-Cover/lib/Devel/Cover/Report/Json.pm ( view source; MetaCPAN )

# https://pjcj.net

package Devel::Cover::Report::Json;

use strict;
use warnings;

our $VERSION = '1.51'; # VERSION

use Devel::Cover::DB::IO::JSON;
# use Devel::Cover::Dumper;  # For debugging

sub
my $json = { runs => add_runs($db), summary => $db->{summary} };
  # print "JSON: ", Dumper $json;
  print "JSON sent to $options->{outputdir}/cover.json\n";

  my $io = Devel::Cover::DB::IO::JSON->ne
($json, "$options->{outputdir}/cover.json");
}

1

__END__

=head1 NAME

Devel::Cover::Report::Json - JSON backend for Devel::Cover

=head1 VERSION

version 1.51

=head1 SYNOPSIS

 cover -report json
Devel-Cover ( P/PJ/PJCJ/Devel-Cover-1.51.tar.gz, PJCJ, 2025; MetaCPAN )
Devel-Cover/lib/Devel/Cover/DB/IO/JSON.pm ( view source; MetaCPAN )
:JSON;

use strict;
use warnings;

use base "Devel::Cover::DB::IO::Base";

use JSON::MaybeXS ();

our $VERSION = '1.51'; # VERSION

sub new {
  my $class = shift;
  my %args  = @_;
  my $json  = JSON:
, allow_blessed => 1);
  $json->ascii->pretty->canonical
    if exists $args{options} && $args{options} =~ /\bpretty\b/i;
  my $self = $class->SUPER::new(%args, json => $json);
  bless $self, $class
}
y ($fh) = @_;
      local $/;
      my $data = eval { $self->{json}->decode(<$fh>) };
      die "Can't read $file with ", (ref $self->{json}), ": $@" if $@;
      $data
    }
  )
}

sub write {
  my $
Devel-Cover ( P/PJ/PJCJ/Devel-Cover-1.51.tar.gz, PJCJ, 2025; MetaCPAN )
Devel-Cover/lib/Devel/Cover.pm ( view source; MetaCPAN )
 my $mymeta = "$Dir/MYMETA.json";
  if (-e $mymeta) {
    eval {
      require CPAN::Meta;
      my $json = CPAN::Meta->load_file($mymeta)->as_struct;
      $Run{$_} = $json->{$_} for qw( name version
 new module.  This has happened with
  # the Storable backend.  I don't think it happens with the JSON backend.
  my $Normalising;

  sub normalised_file {
    my ($file) = @_;

    return $File_cache
if you want to run cpancover.

=item * L<JSON::MaybeXS>

JSON is used to store the coverage database if it is available. JSON::MaybeXS
will select the best JSON backend installed.

=back

=head2 Use w
Devel-Cover ( P/PJ/PJCJ/Devel-Cover-1.51.tar.gz, PJCJ, 2025; MetaCPAN )
Devel-Cover/lib/Devel/Cover/Collection.pm ( view source; MetaCPAN )
ERSION

use Devel::Cover::DB           ();
use Devel::Cover::DB::IO::JSON ();
use Devel::Cover::Dumper       qw( Dumper );

use JSON::MaybeXS      ();
use Parallel::Iterator qw( iterate_as_array );
us
lf->report, "--outputfile",
      $self->output_file);
  $output .= $self->fsys(@cmd, "-report", "json", "-nosummary");

  # TODO - option to merge DB with existing one
  # TODO - portability
  $outpu
dir) };
      warn "\n\n\n[$dir]: $@\n\n\n" if $@;
    },
    $self->build_dirs
  );
}

sub write_json ($self, $vars) {
  # print Dumper $vars;
  my $results = {};
  for my $module (keys $vars->{vals}
Devel-Cover ( P/PJ/PJCJ/Devel-Cover-1.51.tar.gz, PJCJ, 2025; MetaCPAN )
Devel-Cover/lib/Devel/Cover/DB/IO.pm ( view source; MetaCPAN )
coder; 1";
  $Format = "JSON"     if !$Format and eval { require JSON::MaybeXS; 1 };
  $Format = "Storable" if !$Format and eval "use Storable; 1";
  die "Can't load either JSON or Storable" unless $F
ainting
  die "Devel::Cover: Unrecognised DB format: $format"
    unless $format =~ /^(?:Storable|JSON|Sereal)$/;

  $class .= "::$format";
  eval "use $class; 1" or die "Devel::Cover: $@";

  $class-
1.51

=head1 SYNOPSIS

 use Devel::Cover::DB::IO;

 my $io = Devel::Cover::DB::IO->new(format => "JSON");
 my $data = $io->read($file);
 $io->write($data, $file);

=head1 DESCRIPTION

This module prov

Powered by Groonga
Maintained by Kenichi Ishigaki <ishigaki@cpan.org>. If you find anything, submit it on GitHub.