This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Avoid leaving a VAR.txt after testing terminates on any platform where
authorNicholas Clark <nick@ccl4.org>
Wed, 29 Oct 2008 19:34:05 +0000 (19:34 +0000)
committerNicholas Clark <nick@ccl4.org>
Wed, 29 Oct 2008 19:34:05 +0000 (19:34 +0000)
you can't unlink an open file by instead opening $^X for read to get a
file handle for test purposes.

p4raw-id: //depot/perl@34639

ext/XS/APItest/t/svpeek.t

index 3afb039..69d80d7 100644 (file)
@@ -58,11 +58,10 @@ like (DPeek ($1), qr'^PVMG\("',                     ' $1');
   is (DPeek (sub {}),  '\CV(__ANON__)',        'sub {}');
 
 { our ($VAR, @VAR, %VAR);
-  open VAR, ">VAR.txt";
+  open VAR, "<", $^X or die "Can't open $^X: $!";
   sub VAR {}
   format VAR =
 .
-  END { unlink "VAR.txt" };
 
   is (DPeek ( $VAR),   'UNDEF',                ' $VAR undef');
   is (DPeek (\$VAR),   '\UNDEF',               '\$VAR undef');