diff --git a/CHANGES b/CHANGES index e9400c9f..df1b3fc0 100644 --- a/CHANGES +++ b/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. diff --git a/Cover.pm b/Cover.pm index 23a21ecf..d0da6d99 100644 --- a/Cover.pm +++ b/Cover.pm @@ -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,7 +234,7 @@ 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 @@ -242,6 +242,7 @@ Requirements: -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 diff --git a/Cover/Process.pm b/Cover/Process.pm index d8f5245f..83b78761 100644 --- a/Cover/Process.pm +++ b/Cover/Process.pm @@ -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 () { - 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"; } } diff --git a/Makefile.PL b/Makefile.PL index 8d68e606..cc7dbe79 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -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'; diff --git a/README b/README index b661ae83..61ea9d65 100644 --- a/README +++ b/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. diff --git a/t/t1.t b/t/t1.t index a19d15c2..1c4f204f 100644 --- a/t/t1.t +++ b/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;