summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/Dist/CheckConflicts.pm5
-rw-r--r--t/lib/warn/Foo/Conflicts.pm10
-rw-r--r--t/lib/warn/Foo/Thing.pm9
-rw-r--r--t/warn.t16
4 files changed, 39 insertions, 1 deletions
diff --git a/lib/Dist/CheckConflicts.pm b/lib/Dist/CheckConflicts.pm
index b1c78ef..6357b31 100644
--- a/lib/Dist/CheckConflicts.pm
+++ b/lib/Dist/CheckConflicts.pm
@@ -268,7 +268,10 @@ sub calculate_conflicts {
CONFLICT:
for my $conflict (keys %conflicts) {
- my $success = eval { require_module($conflict) };
+ my $success = do {
+ local $SIG{__WARN__} = sub {};
+ eval { require_module($conflict) };
+ };
my $error = $@;
my $file = module_notional_filename($conflict);
next if not $success and $error =~ /Can't locate \Q$file\E in \@INC/;
diff --git a/t/lib/warn/Foo/Conflicts.pm b/t/lib/warn/Foo/Conflicts.pm
new file mode 100644
index 0000000..e55ead3
--- /dev/null
+++ b/t/lib/warn/Foo/Conflicts.pm
@@ -0,0 +1,10 @@
+package Foo::Conflicts;
+use strict;
+use warnings;
+
+use Dist::CheckConflicts
+ -conflicts => {
+ 'Foo::Thing' => 0.01,
+ };
+
+1;
diff --git a/t/lib/warn/Foo/Thing.pm b/t/lib/warn/Foo/Thing.pm
new file mode 100644
index 0000000..8dfa0b4
--- /dev/null
+++ b/t/lib/warn/Foo/Thing.pm
@@ -0,0 +1,9 @@
+package Foo::Thing;
+use strict;
+use warnings;
+
+our $VERSION = 0.02;
+
+warn "Loading Foo::Thing";
+
+1;
diff --git a/t/warn.t b/t/warn.t
new file mode 100644
index 0000000..1058eb9
--- /dev/null
+++ b/t/warn.t
@@ -0,0 +1,16 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More;
+use lib 't/lib/warn';
+
+{
+ use_ok("Foo::Conflicts");
+
+ my $warning = '';
+ local $SIG{__WARN__} = sub { $warning .= $_[0] };
+ my $conflicts = Foo::Conflicts->calculate_conflicts;
+ is($warning, '', "we don't see warnings from loaded modules");
+}
+
+done_testing;