Author: dagolden
Date: Sat Dec  5 04:52:25 2009
New Revision: 13639

Modified:
   Module-Build/trunk/Changes
   Module-Build/trunk/t/bundle_inc.t
   Module-Build/trunk/t/lib/MBTest.pm

Log:
protect against tempfile errors checking EU::Installed

Modified: Module-Build/trunk/Changes
==============================================================================
--- Module-Build/trunk/Changes  (original)
+++ Module-Build/trunk/Changes  Sat Dec  5 04:52:25 2009
@@ -1,6 +1,8 @@
 Revision history for Perl extension Module::Build.
 
-0.35_13 - 
+0.35_13 -
+
+ - Protect against tempfile errors when checking ExtUtils::Installed
 
 0.35_12 - Fri Dec  4 23:06:49 EST 2009
 

Modified: Module-Build/trunk/t/bundle_inc.t
==============================================================================
--- Module-Build/trunk/t/bundle_inc.t   (original)
+++ Module-Build/trunk/t/bundle_inc.t   Sat Dec  5 04:52:25 2009
@@ -11,10 +11,6 @@
 use ExtUtils::Installed;
 use File::Path;
 
-sub _check_EUI {
-  stdout_stderr_of( sub { ExtUtils::Installed->new(extra_libs => [...@inc]) });
-}
-
 # Ensure any Module::Build modules are loaded from correct directory
 blib_load('Module::Build');
 blib_load('Module::Build::ConfigData');
@@ -22,7 +18,7 @@
 if ( $ENV{PERL_CORE} ) {
   plan skip_all => 'bundle_inc tests will never succeed in PERL_CORE';
 }
-elsif ( timed_out( \&_check_EUI ) ) {
+elsif ( ! MBTest::check_EUI() ) {
   plan skip_all => 'ExtUtils::Installed takes too long on your system';
 }
 elsif ( Module::Build::ConfigData->feature('inc_bundling_support') ) {

Modified: Module-Build/trunk/t/lib/MBTest.pm
==============================================================================
--- Module-Build/trunk/t/lib/MBTest.pm  (original)
+++ Module-Build/trunk/t/lib/MBTest.pm  Sat Dec  5 04:52:25 2009
@@ -2,6 +2,7 @@
 
 use strict;
 
+use IO::File ();
 use File::Spec;
 use File::Temp ();
 use File::Path ();
@@ -108,7 +109,7 @@
 
 { # backwards compatible temp filename recipe adapted from perlfaq
   my $tmp_count = 0;
-  my $tmp_base_name = sprintf("%d-%d", $$, time());
+  my $tmp_base_name = sprintf("MB-%d-%d", $$, time());
   sub temp_file_name {
     sprintf("%s-%04d", $tmp_base_name, ++$tmp_count)
   }
@@ -124,7 +125,7 @@
 
 sub save_handle {
   my ($handle, $subr) = @_;
-  my $outfile = temp_file_name();
+  my $outfile = File::Spec->catfile(File::Spec->tmpdir, temp_file_name());
 
   local *SAVEOUT;
   open SAVEOUT, ">&" . fileno($handle)
@@ -257,5 +258,17 @@
   return $saw_alarm;
 }
 
+sub check_EUI {
+  my $timed_out;
+  stdout_stderr_of( sub {
+      $timed_out = timed_out( sub {
+          ExtUtils::Installed->new(extra_libs => [...@inc])
+        }
+      );
+    }
+  );
+  return ! $timed_out;
+}
+
 1;
 # vim:ts=2:sw=2:et:sta

Reply via email to