Permalink
Browse files

uncouple warnings from SIG warn so they don't inadvertantly cause dies

  • Loading branch information...
1 parent ac8fa32 commit 82710ac8f0718879735a49d565edc6ade878fa6a @wchristian wchristian committed Oct 13, 2011
Showing with 16 additions and 2 deletions.
  1. +1 −1 lib/Devel/Cover.pm
  2. +1 −1 lib/Devel/Cover/DB/Structure.pm
  3. +2 −0 tests/COP.pm
  4. +12 −0 tests/cop.t
View
@@ -534,7 +534,7 @@ sub use_file
# system "pwd; ls -l '$file'";
$Files{$file} = -e $file ? 1 : 0;
- warn __PACKAGE__ . qq(: Can't find file "$file" (@_): ignored.\n)
+ print STDERR __PACKAGE__ . qq(: Can't find file "$file" (@_): ignored.\n)
unless $Files{$file} || $Silent || $file =~ $Moose_filenames;
$Files{$file}
@@ -230,7 +230,7 @@ sub digest
}
else
{
- warn "Devel::Cover: Can't open $file for MD5 digest: $!\n"
+ print STDERR "Devel::Cover: Can't open $file for MD5 digest: $!\n"
unless lc $file eq "-e" or
$file =~ $Devel::Cover::Moose_filenames;
# require "Cwd"; warn Carp::longmess("in " . Cwd::cwd());
View
@@ -0,0 +1,2 @@
+#line 64 "Parser.yp"
+1;
View
@@ -0,0 +1,12 @@
+use strict;
+use warnings;
+
+use Test::More;
+use Devel::Cover;
+
+use lib 'tests';
+
+$SIG{__WARN__} = sub { die @_ };
+require COP;
+ok 1, "warnings in a file with file location comments don't cause a die";
+done_testing;

0 comments on commit 82710ac

Please sign in to comment.