Permalink
Browse files

import Devel::Cover 0.03

  • Loading branch information...
pjcj committed Nov 3, 2004
1 parent dcaa408 commit a72ad45b51a963f2b867c3d63c629b2e08a5fb4d
Showing with 47 additions and 21 deletions.
  1. +9 −0 CHANGES
  2. +10 −9 Cover.pm
  3. +23 −6 Cover/Process.pm
  4. +1 −1 Makefile.PL
  5. +2 −3 README
  6. +2 −2 t/t1.t
View
@@ -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.
View
@@ -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;
@@ -25,6 +25,7 @@ my $Covering = 1;
my $Indent = 0;
my $Output = "default.cov";
my $Summary = 1;
+my $Details = 0;
my %Cover;
my $Cv;
@@ -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";
}
}
@@ -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
@@ -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
@@ -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
View
@@ -12,7 +12,7 @@ use warnings;
use Carp;
-our $VERSION = "0.02";
+our $VERSION = "0.03";
sub new
{
@@ -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";
}
}
View
@@ -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';
View
5 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)
@@ -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.
View
4 t/t1.t
@@ -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;

0 comments on commit a72ad45

Please sign in to comment.