| Server IP : 170.10.161.225 / Your IP : 216.73.216.78 Web Server : Apache System : Linux vps103298.mylogin.co 4.18.0-513.11.1.el8_9.x86_64 #1 SMP Wed Jan 17 02:00:40 EST 2024 x86_64 User : calvet ( 273824) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : ON Directory : /lib64/perl5/vendor_perl/Devel/Cover/Report/ |
Upload File : |
# Copyright 2014-2019, Paul Johnson (paul@pjcj.net)
# This software is free. It is licensed under the same terms as Perl itself.
# The latest version of this software should be available from my homepage:
# http://www.pjcj.net
package Devel::Cover::Report::Json;
use strict;
use warnings;
our $VERSION = '1.33'; # VERSION
use Devel::Cover::DB::IO::JSON;
# use Devel::Cover::Dumper; # For debugging
sub add_runs
{
my ($db) = @_;
my @runs;
for my $r (sort {$a->{start} <=> $b->{start}} $db->runs) {
push @runs, {
map { $_ => $r->$_ }
qw( run perl OS dir name version abstract start finish )
};
}
\@runs
}
sub report
{
my ($pkg, $db, $options) = @_;
my %options = map { $_ => 1 } grep !/path|time/, $db->all_criteria, "force";
$db->calculate_summary(%options);
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->new(options => "pretty");
$io->write($json, "$options->{outputdir}/cover.json");
}
1
__END__
=head1 NAME
Devel::Cover::Report::Json - JSON backend for Devel::Cover
=head1 VERSION
version 1.33
=head1 SYNOPSIS
cover -report json
=head1 DESCRIPTION
This module provides JSON output for coverage data.
It is designed to be called from the C<cover> program.
=head1 SEE ALSO
Devel::Cover
=head1 BUGS
Huh?
=head1 LICENCE
Copyright 2014-2019, Paul Johnson (paul@pjcj.net)
This software is free. It is licensed under the same terms as Perl itself.
The latest version of this software should be available from my homepage:
http://www.pjcj.net
=cut