Skip to content

Commit

Permalink
import Devel::Cover 0.03
Browse files Browse the repository at this point in the history
  • Loading branch information
pjcj committed Nov 3, 2004
1 parent dcaa408 commit a72ad45
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 21 deletions.
9 changes: 9 additions & 0 deletions CHANGES
@@ -1,3 +1,12 @@
Devel::Cover.pm history

Release 0.01 - Initial release - 9th April 2001

Release 0.02 - 10th April 2001
- Add summary output.
- Add -S option to turn it off.
- Turn Devel::Cover::Process into a class.

Release 0.03 - 10th April 2001
- Add detailed output.
- Add -d option to turn it on.
19 changes: 10 additions & 9 deletions Cover.pm
Expand Up @@ -12,10 +12,10 @@ use warnings;

use DynaLoader ();

use Devel::Cover::Process 0.02;
use Devel::Cover::Process 0.03;

our @ISA = qw( DynaLoader );
our $VERSION = "0.02";
our $VERSION = "0.03";

use B qw( class main_root main_start main_cv svref_2object OPf_KIDS );
use Data::Dumper;
Expand All @@ -25,6 +25,7 @@ my $Covering = 1;
my $Indent = 0;
my $Output = "default.cov";
my $Summary = 1;
my $Details = 0;

my %Cover;
my $Cv;
Expand All @@ -45,6 +46,7 @@ sub import
/^-i/ && do { $Indent = shift; next };
/^-o/ && do { $Output = shift; next };
/^-S/ && do { $Summary = 0; next };
/^-d/ && do { $Details = 1; next };
warn __PACKAGE__ . ": Unknown option $_ ignored\n";
}
}
Expand Down Expand Up @@ -95,11 +97,9 @@ sub report
close OUT or die "Cannot close $Output\n";
}

if ($Summary)
{
my $cover = Devel::Cover::Process->new(cover => \%Cover);
$cover->print_summary;
}
my $cover = Devel::Cover::Process->new(cover => \%Cover);
$cover->print_summary if $Summary;
$cover->print_details if $Details;
}

sub walk_topdown
Expand Down Expand Up @@ -205,7 +205,7 @@ __END__
Devel::Cover - a module to provide code coverage for Perl
Version 0.02 - 10th May 2001
Version 0.03 - 10th May 2001
=head1 SYNOPSIS
Expand Down Expand Up @@ -234,14 +234,15 @@ Coverage data for other metrics are collected, but not reported.
Coverage data for some metrics are not yet collected.
Requirements:
Perl 5.6.1 or bleadperl.
Perl 5.6.1 or 5.7.1.
The ability to compile XS extensions.
=head1 OPTIONS
-o file - Send output to file (default default.cov).
-i indent - Set indentation level to indent. See Data::Dumper for details.
-S - Don't print summary information.
-d - Print detailed information.
=head1 TUTORIAL
Expand Down
29 changes: 23 additions & 6 deletions Cover/Process.pm
Expand Up @@ -12,7 +12,7 @@ use warnings;

use Carp;

our $VERSION = "0.02";
our $VERSION = "0.03";

sub new
{
Expand Down Expand Up @@ -129,21 +129,38 @@ sub print_summary
}

printf $fmt, "-" x 42, ("------") x 5;
print "\n\n";
}

sub print_details
{
my $self = shift;
for my $file (sort keys %{$self->{cover}})
my (@files) = @_;
@files = sort keys %{$self->{cover}} unless @files;
for my $file (@files)
{
print "$file\n\n";
my $lines = $self->{cover}{$file};
for my $line (sort { $a <=> $b } keys %$lines)
my $fmt = "%-5d: %6s %s\n";

open F, $file or croak "Unable to open $file: $!";

while (<F>)
{
my $l = $lines->{$line};
printf "%4d: " . ("%6d" x @$l) . "\n", $line, @$l;
if (exists $lines->{$.})
{
my @c = @{$lines->{$.}};
printf "%5d: %6d %s", $., shift @c, $_;
printf " : %6d\n", $., shift @c while @c;
}
else
{
printf "%5d: %s", $., $_;
}
}
print "\n";

close F or croak "Unable to close $file: $!";
print "\n\n";
}
}

Expand Down
2 changes: 1 addition & 1 deletion Makefile.PL
Expand Up @@ -16,7 +16,7 @@ use ExtUtils::MakeMaker;

$| = 1;

my $Version = "0.02";
my $Version = "0.03";
my $Date = "10th May 2001";
my $Author = 'pjcj@cpan.org';

Expand Down
5 changes: 2 additions & 3 deletions README
@@ -1,7 +1,7 @@
NAME
Devel::Cover - a module to provide code coverage for Perl

Version 0.02 - 10th May 2001
Version 0.03 - 10th May 2001

DESCRIPTION
Copyright 2001, Paul Johnson (pjcj@cpan.org)
Expand All @@ -24,6 +24,5 @@ DESCRIPTION
data for other metrics are collected, but not reported. Coverage data
for some metrics are not yet collected.

Requirements: Perl 5.6.1 or bleadperl. The ability to compile XS
extensions.
Requirements: Perl 5.6.1 or 5.7.1. The ability to compile XS extensions.

4 changes: 2 additions & 2 deletions t/t1.t
Expand Up @@ -7,8 +7,8 @@
# The latest version of this software should be available from my homepage:
# http://www.pjcj.net

use Devel::Cover::Process 0.02 qw( cover_read );
use Devel::Cover 0.02 qw( -i 1 -o t1.cov );
use Devel::Cover::Process 0.03 qw( cover_read );
use Devel::Cover 0.03 qw( -i 1 -o t1.cov );

use strict;
use warnings;
Expand Down

0 comments on commit a72ad45

Please sign in to comment.