chromatic wrote:
!The code could be simpler with a little less duplication. Here's a
!first stab at making things easier:
!
!sub filename
!{
! my ($name, $mode) = @_;
! $name .= '.' if $^O eq 'VMS;
! return "$mode$name";
!}
That is a great idea and thanks for the suggestion. Here is a re-issue of
the patch in clear text:
diff -ru perl-5.8.1-RC2.orig/ext/Encode/t/enc_eucjp.t
perl-5.8.1-RC2/ext/Encode/t/enc_eucjp.t
--- perl-5.8.1-RC2.orig/ext/Encode/t/enc_eucjp.t 2003-07-10 02:10:44.000000000
-0400
+++ perl-5.8.1-RC2/ext/Encode/t/enc_eucjp.t 2003-07-22 11:05:17.273011000 -0400
@@ -31,8 +31,9 @@
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]);
@@ -42,7 +43,8 @@
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);
@@ -50,7 +52,7 @@
$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: $!";
@@ -68,6 +70,14 @@
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;
}
diff -ru perl-5.8.1-RC2.orig/ext/Encode/t/enc_utf8.t
perl-5.8.1-RC2/ext/Encode/t/enc_utf8.t
--- perl-5.8.1-RC2.orig/ext/Encode/t/enc_utf8.t 2003-07-10 02:10:44.000000000 -0400
+++ perl-5.8.1-RC2/ext/Encode/t/enc_utf8.t 2003-07-22 11:05:30.841007000 -0400
@@ -26,8 +26,9 @@
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;
@@ -36,7 +37,8 @@
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);
@@ -44,7 +46,7 @@
$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: $!";
@@ -62,6 +64,14 @@
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;
}
diff -ru perl-5.8.1-RC2.orig/ext/Encode/t/perlio.t perl-5.8.1-RC2/ext/Encode/t/perlio.t
--- perl-5.8.1-RC2.orig/ext/Encode/t/perlio.t 2003-07-10 02:10:45.000000000 -0400
+++ perl-5.8.1-RC2/ext/Encode/t/perlio.t 2003-07-21 11:43:06.000000000 -0400
@@ -122,7 +122,10 @@
dump2file("$pfile.$seq", $dtext);
}
}
- $DEBUG or unlink ($sfile, $pfile);
+ if ( ! $DEBUG ) {
+ 1 while unlink ($sfile);
+ 1 while unlink ($pfile);
+ }
}
}
End of Patch.
And here it is as an attachment so as to avoid
Notes imposed line wrap breakage:
(See attached file: encode_tests.patch_2)
Peter Prymmer
encode_tests.patch_2
Description: Binary data
