diff options
author | Father Chrysostomos <sprout@cpan.org> | 2011-09-15 20:22:28 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2011-09-15 21:33:18 -0700 |
commit | 73f1eacaff720d25abf31d54d9d2daf7a063e910 (patch) | |
tree | 8afe92a0ee4f9aa9afbd3c462cdcee6045afcce8 /lib/open.t | |
parent | 879ced66a8499e7f2e830f860f796ce3894ca383 (diff) | |
download | perl-73f1eacaff720d25abf31d54d9d2daf7a063e910.tar.gz |
[perl #92728] open.pm without :std should leave std alone
‘use open’ without :std was turning off layers on STDIN and STDOUT
(but not STDERR), due to a few missing if() conditions and due to an
omission of STDERR (which probably also caused STDERR’s handles to
accumulate through multiple calls to ‘use open ':std'...’).
This fixes that. (As if you were expecting otherwise.)
Diffstat (limited to 'lib/open.t')
-rw-r--r-- | lib/open.t | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/open.t b/lib/open.t index f9cacab8a1..586d8e2c38 100644 --- a/lib/open.t +++ b/lib/open.t @@ -7,7 +7,7 @@ BEGIN { require './test.pl'; } -plan 23; +plan 24; # open::import expects 'open' as its first argument, but it clashes with open() sub import { @@ -195,6 +195,22 @@ SKIP: { "test for an endless loop in PerlIO_find_layer"); } +is runperl( + progs => [ + 'use open q\:encoding(UTF-8)\, q-:std-;', + 'use open q\:encoding(UTF-8)\;', + 'if(($_ = <STDIN>) eq qq-\x{100}\n-) { print qq-stdin ok\n- }', + 'else { print qq-got -, join(q q q, map ord, split//), "\n" }', + 'print STDOUT qq-\x{ff}\n-;', + 'print STDERR qq-\x{ff}\n-;', + ], + stdin => "\xc4\x80\n", + stderr => 1, + ), + "stdin ok\n\xc3\xbf\n\xc3\xbf\n", + "use open without :std does not affect standard handles", +; + END { 1 while unlink "utf8"; 1 while unlink "a"; |