Skip to content
This repository
Browse code

Fix "ignoring extra $criterion" errors.

This is a very old bug that had been perplexing me for years.  Of course, the
solution is trivial, but tracking it down involved hours of debugging using
some rather convoluted code.

Thanks, TPF, for affording me the opportunity find and fix this.
  • Loading branch information...
commit 997426eecb16899d0be425853478e2b5bdf9a1ee 1 parent 870f2db
Paul Johnson authored August 04, 2012

Showing 1 changed file with 4 additions and 5 deletions. Show diff stats Hide diff stats

  1. 9  lib/Devel/Cover/DB/Structure.pm
9  lib/Devel/Cover/DB/Structure.pm
@@ -173,7 +173,7 @@ sub set_subroutine
173 173
         # print STDERR "new $file:$line:$sub_name\n";
174 174
         $self->{count}{$_}{$file} =
175 175
             $self->{f}{$file}{start}{$line}{$sub_name}[$scount]{$_} =
176  
-            $self->get_count($_)
  176
+            $self->get_count($file, $_)
177 177
             for $self->criteria;
178 178
     }
179 179
     # print STDERR "set_subroutine start $file:$line $sub_name($scount) ",
@@ -186,7 +186,7 @@ sub store_counts
186 186
     my ($file) = @_;
187 187
     $self->{count}{$_}{$file} =
188 188
         $self->{f}{$file}{start}{-1}{__COVER__}[0]{$_} =
189  
-        $self->get_count($_)
  189
+        $self->get_count($file, $_)
190 190
         for $self->criteria;
191 191
     # print STDERR "store_counts: ", Dumper $self->{f}{$file}{start};
192 192
 }
@@ -241,9 +241,8 @@ sub digest
241 241
 sub get_count
242 242
 {
243 243
     my $self = shift;
244  
-    my ($criterion) = @_;
245  
-    return 0 unless $self->{file};  # TODO - how does this get unset?
246  
-    $self->{count}{$criterion}{$self->{file}}
  244
+    my ($file, $criterion) = @_;
  245
+    $self->{count}{$criterion}{$file}
247 246
 }
248 247
 
249 248
 sub add_count

0 notes on commit 997426e

Please sign in to comment.
Something went wrong with that request. Please try again.