Change 34178 by [EMAIL PROTECTED] on 2008/08/07 08:23:13

        A proper tempfile function that can be used multiple times.

Affected files ...

... //depot/perl/t/test.pl#86 edit

Differences ...

==== //depot/perl/t/test.pl#86 (text) ====
Index: perl/t/test.pl
--- perl/t/test.pl#85~34173~    2008-08-06 09:04:49.000000000 -0700
+++ perl/t/test.pl      2008-08-07 01:23:13.000000000 -0700
@@ -619,6 +619,9 @@
     }
 }
 
+my @tmpfiles;
+END { unlink_all @tmpfiles }
+
 # Avoid ++, avoid ranges, avoid split //
 my @letters = qw(A B C D E F G H I J K L M N O P Q R S T U V W X Y Z);
 sub tempfile {
@@ -630,14 +633,18 @@
            $try .= $letters[$temp % 26];
            $count = int ($temp / 26);
        } while $temp;
-       return $try unless -e $try;
+       if (!-e $try) {
+           # We have a winner
+           push @tmpfiles, $try;
+           return $try;
+       }
        $count = $count + 1;
     } while $count < 26 * 26;
     die "Can't find temporary file name starting 'tmp$$'";
 }
 
+# This is the temporary file for _fresh_perl
 my $tmpfile = tempfile();
-END { unlink_all $tmpfile }
 
 #
 # _fresh_perl
End of Patch.

Reply via email to