Subject: | Suppress STDOUT/STDERR while running intrusive scan |
Module::Depends::Intrusive runs Makefile.PL to determine dependencies.
Some modules on CPAN (e.g. Net::FTP) are quite chatty during this
process, and if you're running the scan, you don't want those messages
to clutter up the screen. Here's a patch that shuts off STDOUT/STDERR
during the scan and re-establishes them afterwards.
Subject: | mdi.patch |
diff -Naur Module-Depends-0.13/Makefile.PL Module-Depends-0.13.patched/Makefile.PL
--- Module-Depends-0.13/Makefile.PL Tue Jun 26 05:44:36 2007
+++ Module-Depends-0.13.patched/Makefile.PL Fri Aug 3 15:41:48 2007
@@ -11,7 +11,8 @@
'Test::More' => 0,
'YAML' => 0,
'Class::Accessor::Chained' => 0,
- 'File::Spec' => 0
+ 'File::Spec' => 0,
+ 'File::Temp' => 0,
}
)
;
diff -Naur Module-Depends-0.13/lib/Module/Depends/Intrusive.pm Module-Depends-0.13.patched/lib/Module/Depends/Intrusive.pm
--- Module-Depends-0.13/lib/Module/Depends/Intrusive.pm Tue Jun 26 05:44:36 2007
+++ Module-Depends-0.13.patched/lib/Module/Depends/Intrusive.pm Fri Aug 3 16:00:41 2007
@@ -3,6 +3,7 @@
use base qw( Module::Depends );
use Cwd qw( getcwd );
use ExtUtils::MakeMaker ();
+use File::Temp qw(tempfile);
sub _find_modules {
my $self = shift;
@@ -76,12 +77,25 @@
};
my $file = File::Spec->catfile( getcwd(), $pl );
+
+ # Suppress STDOUT/STDERR during the Makefile.PL run
+ my($fh, $filename) = tempfile(UNLINK => 1);
+ open(OLDSTDOUT, ">&STDOUT");
+ open(STDOUT, ">>$filename");
+ open(OLDSTDERR, ">&STDERR");
+ open(STDERR, ">>$filename");
+
eval {
package main;
no strict;
no warnings;
require "$file";
};
+
+ # Re-establish STDOUT/ERR
+ open(STDOUT, ">&OLDSTDOUT");
+ open(STDERR, ">&OLDSTDERR");
+
$self->error( $@ ) if $@;
delete $INC{$file};
return $self;