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
Default IO Layer is ignored in 3-argument open call #8272
Comments
From Nikolaus@rath.orgCreated by Nikolaus@rath.orgThis is a bug report for perl from Nikolaus@rath.org, ----------------------------------------------------------------- #!/usr/bin/perl -CSDA Where utf8.txt contains some utf8 encoded characters. The first open Citing perldoc -f open: will open the UTF-8 encoded file containing Unicode Clearly I didn't specify an IO-layer in my first open call, yet the Perl Info
|
From BQW10602@nifty.com
Thank you for report. But "perl-current" (under development) works This problem seems to have been recently resolved: Regards, |
The RT System itself - Status changed from 'new' to 'open' |
From BQW10602@nifty.com
In this case the open pragma is not loaded but the -C switch is set. P.S. In perlfunc.pod, some C<open> refer to the pragma and others Regards, Inline Patchdiff -ur perl~/lib/open.pm perl/lib/open.pm
--- perl~/lib/open.pm Mon Oct 31 23:56:43 2005
+++ perl/lib/open.pm Sun Jan 08 23:25:39 2006
@@ -169,9 +169,8 @@
"layers" (also known as "disciplines") for all I/O. Any two-argument
open(), readpipe() (aka qx//) and similar operators found within the
lexical scope of this pragma will use the declared defaults.
-Three-argument opens are not affected by this pragma since there you
-(can) explicitly specify the layers and are supposed to know what you
-are doing.
+Even three-argument opens may be affected by this pragma
+when they don't specify IO layers in MODE.
With the C<IN> subpragma you can declare the default layers
of input streams, and with the C<OUT> subpragma you can declare
@@ -180,7 +179,7 @@
If you have a legacy encoding, you can use the C<:encoding(...)> tag.
-if you want to set your encoding layers based on your
+If you want to set your encoding layers based on your
locale environment variables, you can use the C<:locale> tag.
For example:
diff -ur perl~/pod/perlfunc.pod perl/pod/perlfunc.pod
--- perl~/pod/perlfunc.pod Mon Jan 02 23:27:04 2006
+++ perl/pod/perlfunc.pod Mon Jan 09 00:21:37 2006
@@ -3103,14 +3103,14 @@
You may use the three-argument form of open to specify IO "layers"
(sometimes also referred to as "disciplines") to be applied to the handle
that affect how the input and output are processed (see L<open> and
-L<PerlIO> for more details). For example
+L<Encode::PerlIO> for more details). For example
open(FH, "<:utf8", "file")
will open the UTF-8 encoded file containing Unicode characters,
-see L<perluniintro>. (Note that if layers are specified in the
-three-arg form then default layers set by the C<open> pragma are
-ignored.)
+see L<perluniintro>. Note that if layers are specified in the
+three-arg form then default layers stored in ${^OPEN} (see L<perlvar>;
+usually set by the B<open> pragma or the switch B<-CioD>) are ignored.
Open returns nonzero upon success, the undefined value otherwise. If
the C<open> involved a pipe, the return value happens to be the pid of |
From BQW10602@nifty.comA reply to myself...
Sorry this change is wrong. The reference here should be PerlIO.pm P.S. Why does a link to Encode/PerlIO.pm is produced from L<PerlIO> Regards, Inline Patchdiff -ur perl~/lib/open.pm perl/lib/open.pm
--- perl~/lib/open.pm Mon Oct 31 23:56:43 2005
+++ perl/lib/open.pm Mon Jan 09 00:38:52 2006
@@ -169,9 +169,8 @@
"layers" (also known as "disciplines") for all I/O. Any two-argument
open(), readpipe() (aka qx//) and similar operators found within the
lexical scope of this pragma will use the declared defaults.
-Three-argument opens are not affected by this pragma since there you
-(can) explicitly specify the layers and are supposed to know what you
-are doing.
+Even three-argument opens may be affected by this pragma
+when they don't specify IO layers in MODE.
With the C<IN> subpragma you can declare the default layers
of input streams, and with the C<OUT> subpragma you can declare
@@ -180,7 +179,7 @@
If you have a legacy encoding, you can use the C<:encoding(...)> tag.
-if you want to set your encoding layers based on your
+If you want to set your encoding layers based on your
locale environment variables, you can use the C<:locale> tag.
For example:
diff -ur perl~/pod/perlfunc.pod perl/pod/perlfunc.pod
--- perl~/pod/perlfunc.pod Mon Jan 02 23:27:04 2006
+++ perl/pod/perlfunc.pod Mon Jan 09 01:19:16 2006
@@ -3108,9 +3108,9 @@
open(FH, "<:utf8", "file")
will open the UTF-8 encoded file containing Unicode characters,
-see L<perluniintro>. (Note that if layers are specified in the
-three-arg form then default layers set by the C<open> pragma are
-ignored.)
+see L<perluniintro>. Note that if layers are specified in the
+three-arg form then default layers stored in ${^OPEN} (see L<perlvar>;
+usually set by the B<open> pragma or the switch B<-CioD>) are ignored.
Open returns nonzero upon success, the undefined value otherwise. If
the C<open> involved a pipe, the return value happens to be the pid of
##### END OF PATCH |
From @rgarciaOn 1/8/06, SADAHIRO Tomoyuki <bqw10602@nifty.com> wrote:
Thanks, applied as #26739.
A bug ? That should be the PerlIO module... |
From Nikolaus@rath.org
____________________________________________________________________________
Is it possible to somehow work around this problem until the fix reaches Thanks |
p5p@spam.wizbit.be - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#38181 (status was 'resolved')
Searchable as RT38181$
The text was updated successfully, but these errors were encountered: