[perl #71204] diagnostics.pm suppresses 'Use of uninitialized value in range (or...
[p5sagit/p5-mst-13.2.git] / t / run / cloexec.t
index cfbe702..314d5fa 100644 (file)
@@ -35,8 +35,8 @@
 BEGIN {
     chdir 't' if -d 't';
     @INC = '../lib';
-    use Config;
-    if (!$Config{'d_fcntl'}) {
+    require Config;
+    if (!$Config::Config{'d_fcntl'}) {
         print("1..0 # Skip: fcntl() is not available\n");
         exit(0);
     }
@@ -48,11 +48,9 @@ use strict;
 $|=1;
 
 my $Is_VMS      = $^O eq 'VMS';
-my $Is_MacOS    = $^O eq 'MacOS';
 my $Is_Win32    = $^O eq 'MSWin32';
 
 # When in doubt, skip.
-skip_all("MacOS")    if $Is_MacOS;
 skip_all("VMS")      if $Is_VMS;
 skip_all("Win32")    if $Is_Win32;
 
@@ -67,9 +65,9 @@ sub make_tmp_file {
 my $Perl = which_perl();
 my $quote = $Is_VMS || $Is_Win32 ? '"' : "'";
 
-my $tmperr             = 'cloexece.tmp';
-my $tmpfile1           = 'cloexec1.tmp';
-my $tmpfile2           = 'cloexec2.tmp';
+my $tmperr             = tempfile();
+my $tmpfile1           = tempfile();
+my $tmpfile2           = tempfile();
 my $tmpfile1_contents  = "tmpfile1 line 1\ntmpfile1 line 2\n";
 my $tmpfile2_contents  = "tmpfile2 line 1\ntmpfile2 line 2\n";
 make_tmp_file($tmpfile1, $tmpfile1_contents);
@@ -164,9 +162,3 @@ cmp_ok( $parentfd1, '<=', $^F, "parent open fd=$parentfd1 (\$^F=$^F)" );
 test_inherited($parentfd1);
 close FHPARENT1 or die "close '$tmpfile1': $!";
 close FHPARENT2 or die "close '$tmpfile2': $!";
-
-END {
-    defined $tmperr   and unlink($tmperr);
-    defined $tmpfile1 and unlink($tmpfile1);
-    defined $tmpfile2 and unlink($tmpfile2);
-}