diff options
author | Tony Cook <tony@develop-help.com> | 2017-09-20 13:27:11 +1000 |
---|---|---|
committer | Tony Cook <tony@develop-help.com> | 2017-09-20 14:50:45 +1000 |
commit | e91a8fe59e04acc5aa33b600b132452b2e7e6165 (patch) | |
tree | 599bdb7be0a4b9c05d57c41dc6b1c380463d0863 /lib | |
parent | 3e09f0e17830742b74b979b35847f68f775468cd (diff) | |
download | perl-e91a8fe59e04acc5aa33b600b132452b2e7e6165.tar.gz |
avoid sysread()/syswrite() warnings from the default :utf8 from PERL_UNICODE
In a UTF-8 locale, if the PERL_UNICODE environment variable is set,
perl may add a :utf8 layer.
v5.23.1-197-gfb10a8a deprecated using sysread(), syswrite() etc on such
handles, which meant that a test run under PERL_UNICODE could produce
a significant number of deprecation warnings.
Prevent those warnings, typically by binmode(), but in one case by
disabling the warning.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/File/Copy.t | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/File/Copy.t b/lib/File/Copy.t index 05590b262f..25f340d1c0 100644 --- a/lib/File/Copy.t +++ b/lib/File/Copy.t @@ -66,12 +66,14 @@ for my $cross_partition_test (0..1) { unlink "copy-$$" or die "unlink: $!"; open(F, "<", "file-$$"); + binmode F; copy(*F, "copy-$$"); - open(R, "<", "copy-$$") or die "open copy-$$: $!"; $foo = <R>; close(R); + open(R, "<:raw", "copy-$$") or die "open copy-$$: $!"; $foo = <R>; close(R); is $foo, "ok\n", 'copy(*F, fn): same contents'; unlink "copy-$$" or die "unlink: $!"; open(F, "<", "file-$$"); + binmode F; copy(\*F, "copy-$$"); close(F) or die "close: $!"; open(R, "<", "copy-$$") or die; $foo = <R>; close(R) or die "close: $!"; @@ -345,6 +347,7 @@ SKIP: { chmod $c_perm3 => $copy6 or die $!; open my $fh => "<", $src or die $!; + binmode $fh; copy ($src, $copy1); copy ($fh, $copy2); @@ -465,6 +468,8 @@ SKIP: { open(my $IN, "-|") || exec $^X, '-e', 'print "Hello, world!\n"'; open(my $OUT, "|-") || exec $^X, '-ne', 'exit(/Hello/ ? 55 : 0)'; + binmode $IN; + binmode $OUT; ok(copy($IN, $OUT), "copy pipe to another"); close($OUT); |