Permalink
Browse files

Improve warnings when a file can't be found.

Make them more consistent and reduce duplicates.
  • Loading branch information...
1 parent 2ce2de5 commit 6b76e770cacb5c4593c9eb9a7038b69167a9ff7b @pjcj committed Nov 24, 2012
Showing with 7 additions and 4 deletions.
  1. +7 −4 lib/Devel/Cover/DB.pm
View
@@ -619,7 +619,7 @@ sub uncoverable
# print STDERR "Reading $file\n";
open my $fh, "<", $file or do
{
- warn "Devel::Cover: Can't open file $file: $!\n";
+ warn "Devel::Cover: Can't open $file: $!\n";
next;
};
my $df = Digest::MD5->new; # MD5 digest of the file
@@ -724,7 +724,8 @@ sub uncoverable_comments
# Look for uncoverable comments
open my $fh, "<", $file or do
{
- warn "Devel::Cover: Can't open file $file: $!\n";
+ # The warning should have already been given ...
+ # warn "Devel::Cover: Warning: can't open $file: $!\n";
return;
};
my @waiting;
@@ -898,6 +899,7 @@ sub cover
keys %{$self->{runs}};
# print STDERR "runs: ", Dumper $self->{runs};
+ my %warned;
for my $run (@runs)
{
last unless $st;
@@ -941,8 +943,9 @@ sub cover
# print STDERR "$criterion: ", Dumper $sc, $fc;
unless ($sc)
{
- print STDERR "Devel::Cover: Can't locate structure for ",
- "$criterion in $file\n";
+ print STDERR "Devel::Cover: Warning: can't locate ",
+ "structure for $criterion in $file\n"
+ unless $warned{$file}{$criterion}++;
next;
}
my $cc = $cf->{$criterion} ||= {};

0 comments on commit 6b76e77

Please sign in to comment.