for my $i (0..$#c) {
no warnings 'pack';
- push @f, "f$i";
- open(F, ">f$i") or die "$0: failed to open 'f$i' for writing: $!";
+ my $file = filename("f$i");
+ push @f, $file;
+ open(F, ">$file") or die "$0: failed to open '$file' for writing: $!";
binmode(F, ":utf8");
print F chr($c[$i]);
print F pack("C" => $c[$i]);
my $t = 1;
for my $i (0..$#c) {
- open(F, "<f$i") or die "$0: failed to open 'f$i' for reading: $!";
+ my $file = filename("f$i");
+ open(F, "<$file") or die "$0: failed to open '$file' for reading: $!";
binmode(F, ":utf8");
my $c = <F>;
my $o = ord($c);
$t++;
}
-my $f = "f" . @f;
+my $f = filename("f" . @f);
push @f, $f;
open(F, ">$f") or die "$0: failed to open '$f' for writing: $!";
print $a =~ qr{^utf8 "\\x80" does not map to Unicode} ?
"ok $t - illegal utf8 input\n" : "not ok $t - illegal utf8 input: a = " . unpack("H*", $a) . "\n";
+# On VMS temporary file names like "f0." may be more readable than "f0" since
+# "f0" could be a logical name pointing elsewhere.
+sub filename {
+ my $name = shift;
+ $name .= '.' if $^O eq 'VMS';
+ return $name;
+}
+
END {
1 while unlink @f;
}
my @f;
for my $i (0..$#c) {
- push @f, "f$i";
- open(F, ">f$i") or die "$0: failed to open 'f$i' for writing: $!";
+ my $file = filename("f$i");
+ push @f, $file;
+ open(F, ">$file") or die "$0: failed to open '$file' for writing: $!";
binmode(F, ":utf8");
print F chr($c[$i]);
close F;
my $t = 1;
for my $i (0..$#c) {
- open(F, "<f$i") or die "$0: failed to open 'f$i' for reading: $!";
+ my $file = filename("f$i");
+ open(F, "<$file") or die "$0: failed to open '$file' for reading: $!";
binmode(F, ":utf8");
my $c = <F>;
my $o = ord($c);
$t++;
}
-my $f = "f" . @f;
+my $f = filename("f" . @f);
push @f, $f;
open(F, ">$f") or die "$0: failed to open '$f' for writing: $!";
print $a =~ qr{^utf8 "\\x80" does not map to Unicode} ?
"ok $t - illegal utf8 input\n" : "not ok $t - illegal utf8 input: a = " . unpack("H*", $a) . "\n";
+# On VMS temporary file names like "f0." may be more readable than "f0" since
+# "f0" could be a logical name pointing elsewhere.
+sub filename {
+ my $name = shift;
+ $name .= '.' if $^O eq 'VMS';
+ return $name;
+}
+
END {
1 while unlink @f;
}
dump2file("$pfile.$seq", $dtext);
}
}
- $DEBUG or unlink ($sfile, $pfile);
+ unless ( $DEBUG ) {
+ 1 while unlink $sfile;
+ 1 while unlink $pfile;
+ }
}
}