New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Layers not applied to redirected filehandles #8997
Comments
From @clintongormleyCreated by @clintongormleyThis is a bug report for perl from clint@traveljury.com, ----------------------------------------------------------------- When duplicating a filehandle, layers applied to that filehandle ------------------------------------ my $utf8="\xe9"; close (STDOUT); print ("STDOUT: ",$utf8,"\n"); binmode (STDERR,':utf8'); STDOUT: é I would consider this a bug - I would have expected the existing layers to be taken Inline Patch--- Desktop/perlfunc.pod.orig 2007-08-16 13:56:42.000000000 +0200
+++ Desktop/perlfunc.pod 2007-08-16 14:04:05.000000000 +0200
@@ -3198,6 +3198,18 @@
print STDOUT "stdout 2\n";
print STDERR "stderr 2\n";
+Note: Currently, when duplicating file handles, layers applied to
+the destination file handle need to be reapplied to the duplicated handle.
+This can only be done with L<binmode>.
+
+For example:
+
+ open STDOUT, '>:utf8', 'foo.out' or die "Can't redirect STDOUT: $!";
+ open STDERR, '>&STDOUT' or die "Can't dup STDOUT: $!";
+
+ # apply :utf8 layer to STDERR
+ binmode (STDERR,':utf8');
+
If you specify C<< '<&=X' >>, where C<X> is a file descriptor number
or a filehandle, then Perl will do an equivalent of C's C<fdopen> of
that file descriptor (and not call L<dup(2)>); this is more Perl Info
|
From @jkeenanOn Thu, 16 Aug 2007 12:49:00 GMT, DrTech wrote:
Assuming I understand the problem correctly, I cannot reproduce the problem in any perl from 5.8.9 forward. I'm attaching two programs, one with binmode in effect and one with binmode commented out. I get the same results from each. ##### $ cat ftest.txt $cat gtest.txt If the results are the same, then there's no need to patch the documentation. Thank you very much. |
From @jkeenan |
The RT System itself - Status changed from 'new' to 'open' |
Migrated from rt.perl.org#44701 (status was 'open')
Searchable as RT44701$
The text was updated successfully, but these errors were encountered: