Skip to content
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

'perldoc -f open' :encoding clarification #15361

Closed
p5pRT opened this issue May 26, 2016 · 11 comments
Closed

'perldoc -f open' :encoding clarification #15361

p5pRT opened this issue May 26, 2016 · 11 comments

Comments

@p5pRT
Copy link

p5pRT commented May 26, 2016

Migrated from rt.perl.org#128245 (status was 'open')

Searchable as RT128245$

@p5pRT
Copy link
Author

p5pRT commented May 26, 2016

From john.harig@booking.com

Created by john.harig@booking.com

An example contained in 'perldoc -f open' states to use :encoding.
When running 'perldoc encoding', it goes to a page for the encoding
pragma which is deprecated as of 5.18. However, the 'open' reference
is actually to PerlIO​::encoding. To avoid confusion, I have added a
phrase to the 'open' section of perlfunc.pm to avoid confusion.

Perl Info

Flags:
    category=docs
    severity=low
    Type=Patch
    PatchStatus=HasPatch

Site configuration information for perl 5.25.2:

Configured by user01 at Wed May 25 19:22:33 CEST 2016.

Summary of my perl5 (revision 5 version 25 subversion 2) configuration:
  Derived from: cbef69c1c0b28f5a8e50e67afea1ff67dcce20aa
  Platform:
    osname=linux, osvers=4.5.0-0.bpo.2-amd64, archname=x86_64-linux
    uname='linux nyc3-186 4.5.0-0.bpo.2-amd64 #1 smp debian 4.5.3-2~bpo8+1 (2016-05-13) x86_64 gnulinux '
    config_args='-des -Dusedevel'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=undef, usemultiplicity=undef
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2',
    optimize='-O2',
    cppflags='-fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include'
    ccversion='', gccversion='4.9.2', gccosandvers=''
    intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678, doublekind=3
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16, longdblkind=3
    ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -fstack-protector-strong -L/usr/local/lib'
    libpth=/usr/local/lib /usr/lib/gcc/x86_64-linux-gnu/4.9/include-fixed /usr/include/x86_64-linux-gnu /usr/lib /lib/x86_64-linux-gnu /lib/../lib /usr/lib/x86_64-linux-gnu /usr/lib/../lib /lib
    libs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
    perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
    libc=libc-2.19.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.19'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
    cccdlflags='-fPIC', lddlflags='-shared -O2 -L/usr/local/lib -fstack-protector-strong'

Locally applied patches:
    uncommitted-changes


@INC for perl 5.25.2:
    lib
    /home/user01/perl5/lib/perl5
    /usr/local/lib/perl5/site_perl/5.25.2/x86_64-linux
    /usr/local/lib/perl5/site_perl/5.25.2
    /usr/local/lib/perl5/5.25.2/x86_64-linux
    /usr/local/lib/perl5/5.25.2
    .


Environment for perl 5.25.2:
    HOME=/home/user01
    LANG=en_US.utf8
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/home/user01/perl5/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
    PERL5LIB=/home/user01/perl5/lib/perl5
    PERL_BADLANG (unset)
    PERL_LOCAL_LIB_ROOT=/home/user01/perl5
    PERL_MB_OPT=--install_base "/home/user01/perl5"
    PERL_MM_OPT=INSTALL_BASE=/home/user01/perl5
    SHELL=/bin/bash

--------------1.40.perlbug
Content-Type: text/x-patch; name="0001-pod-text-insertion-regarding-encoding-in-open-functi.patch"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="0001-pod-text-insertion-regarding-encoding-in-open-functi.patch"

From 8acb834322dca79dfdaf5a47e9fae6b849608652 Mon Sep 17 00:00:00 2001
From: user01 <user01@NYC-186.booking.pcln.com>
Date: Wed, 25 May 2016 19:41:19 +0200
Subject: [PATCH] pod text insertion regarding :encoding in open function


 cpan/Pod-Perldoc/corpus/perlfunc.pod | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/cpan/Pod-Perldoc/corpus/perlfunc.pod b/cpan/Pod-Perldoc/corpus/perlfunc.pod
index 604123d..7c6e6ee 100644
--- a/cpan/Pod-Perldoc/corpus/perlfunc.pod
+++ b/cpan/Pod-Perldoc/corpus/perlfunc.pod
@@ -3539,7 +3539,9 @@ three-argument form, then default layers stored in ${^OPEN} (see L<perlvar>;
 usually set by the B<open> pragma or the switch B<-CioD>) are ignored.
 Those layers will also be ignored if you specifying a colon with no name
 following it.  In that case the default layer for the operating system
-(:raw on Unix, :crlf on Windows) is used.
+(:raw on Unix, :crlf on Windows) is used. For clarification, C<:encoding> in 
+the above example is a reference to the core module L<PerlIO::encoding>, and
+not to the deprecated (as of version 5.18) L<encoding> pragma.
 
 Open returns nonzero on success, the undefined value otherwise.  If
 the C<open> involved a pipe, the return value happens to be the pid of
-- 
2.1.4


--------------1.40.perlbug--

@p5pRT
Copy link
Author

p5pRT commented May 26, 2016

From john.harig@booking.com

0001-pod-text-insertion-regarding-encoding-in-open-functi.patch
From 8acb834322dca79dfdaf5a47e9fae6b849608652 Mon Sep 17 00:00:00 2001
From: user01 <user01@NYC-186.booking.pcln.com>
Date: Wed, 25 May 2016 19:41:19 +0200
Subject: [PATCH] pod text insertion regarding :encoding in open function

---
 cpan/Pod-Perldoc/corpus/perlfunc.pod | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/cpan/Pod-Perldoc/corpus/perlfunc.pod b/cpan/Pod-Perldoc/corpus/perlfunc.pod
index 604123d..7c6e6ee 100644
--- a/cpan/Pod-Perldoc/corpus/perlfunc.pod
+++ b/cpan/Pod-Perldoc/corpus/perlfunc.pod
@@ -3539,7 +3539,9 @@ three-argument form, then default layers stored in ${^OPEN} (see L<perlvar>;
 usually set by the B<open> pragma or the switch B<-CioD>) are ignored.
 Those layers will also be ignored if you specifying a colon with no name
 following it.  In that case the default layer for the operating system
-(:raw on Unix, :crlf on Windows) is used.
+(:raw on Unix, :crlf on Windows) is used. For clarification, C<:encoding> in 
+the above example is a reference to the core module L<PerlIO::encoding>, and
+not to the deprecated (as of version 5.18) L<encoding> pragma.
 
 Open returns nonzero on success, the undefined value otherwise.  If
 the C<open> involved a pipe, the return value happens to be the pid of
-- 
2.1.4

@p5pRT
Copy link
Author

p5pRT commented May 28, 2016

From @khwilliamson

On 05/26/2016 03​:05 AM, John Harig (via RT) wrote​:

# New Ticket Created by John Harig
# Please include the string​: [perl #128245]
# in the subject line of all future correspondence about this issue.
# <URL​: https://rt-archive.perl.org/perl5/Ticket/Display.html?id=128245 >

This is a bug report for perl from john.harig@​booking.com,
generated with the help of perlbug 1.40 running under perl 5.25.2.

-----------------------------------------------------------------
[Please describe your issue here]

An example contained in 'perldoc -f open' states to use :encoding.
When running 'perldoc encoding', it goes to a page for the encoding
pragma which is deprecated as of 5.18. However, the 'open' reference
is actually to PerlIO​::encoding. To avoid confusion, I have added a
phrase to the 'open' section of perlfunc.pm to avoid confusion.

This patch should be instead against pod/perlfunc.pod.
pan/Pod-Perldoc/corpus/perlfunc.pod is listed as a test file for
Pod​::Perldoc.

I'll apply your patch if you instead redo it against perlfunc. And do
you want your email listed as user01@​NYC-186.booking.pcln.com?

@p5pRT
Copy link
Author

p5pRT commented May 28, 2016

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Jul 11, 2016

From @tonycoz

On Thu May 26 02​:05​:06 2016, john.harig@​booking.com wrote​:

An example contained in 'perldoc -f open' states to use :encoding.
When running 'perldoc encoding', it goes to a page for the encoding
pragma which is deprecated as of 5.18. However, the 'open' reference
is actually to PerlIO​::encoding. To avoid confusion, I have added a
phrase to the 'open' section of perlfunc.pm to avoid confusion.

Besides the problems Jim mentioned, wouldn't something like the attached be simpler and clearer (since it's attached directly to the example)

Tony

@p5pRT
Copy link
Author

p5pRT commented Jul 11, 2016

From @tonycoz

0001-perl-128245-make-it-obvious-encoding-uses-PerlIO-enc.patch
From 547765fad89d3471995ec84ee548ba4253dbce30 Mon Sep 17 00:00:00 2001
From: Tony Cook <tony@develop-help.com>
Date: Mon, 11 Jul 2016 10:52:20 +1000
Subject: (perl #128245) make it obvious :encoding uses PerlIO::encoding

rather than encoding.pm
---
 pod/perlfunc.pod | 1 +
 1 file changed, 1 insertion(+)

diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod
index 5c778f1..4c013ae 100644
--- a/pod/perlfunc.pod
+++ b/pod/perlfunc.pod
@@ -4343,6 +4343,7 @@ I/O layers (sometimes referred to as "disciplines") to apply to the handle
 that affect how the input and output are processed (see L<open> and
 L<PerlIO> for more details).  For example:
 
+  # loads PerlIO::encoding automatically
   open(my $fh, "<:encoding(UTF-8)", $filename)
     || die "Can't open UTF-8 encoded $filename: $!";
 
-- 
2.1.4

@p5pRT
Copy link
Author

p5pRT commented Jul 11, 2016

From @tonycoz

On Sun Jul 10 17​:53​:55 2016, tonyc wrote​:

Besides the problems Jim mentioned,

Oops, that was Karl, sorry.

Tony

@p5pRT
Copy link
Author

p5pRT commented Jul 11, 2016

From @cpansprout

On Sun Jul 10 17​:53​:55 2016, tonyc wrote​:

On Thu May 26 02​:05​:06 2016, john.harig@​booking.com wrote​:

An example contained in 'perldoc -f open' states to use :encoding.
When running 'perldoc encoding', it goes to a page for the encoding
pragma which is deprecated as of 5.18. However, the 'open' reference
is actually to PerlIO​::encoding. To avoid confusion, I have added a
phrase to the 'open' section of perlfunc.pm to avoid confusion.

Besides the problems Jim mentioned, wouldn't something like the
attached be simpler and clearer (since it's attached directly to the
example)

Tony

Yes, shorter is better (and clearer!) in this particular case.

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Jul 13, 2016

From john.harig@booking.com

Created by john.harig@booking.com

An example contained in 'perldoc -f open' states to use :encoding.
When running 'perldoc encoding', it goes to a page for the encoding
pragma which is deprecated as of 5.18. However, the 'open' reference
is actually to PerlIO​::encoding. To avoid confusion, I have added a
phrase to the 'open' section of perlfunc to avoid confusion.

Perl Info

Flags:
    category=docs
    severity=low
    Type=Patch
    PatchStatus=HasPatch

Site configuration information for perl 5.25.2:

Configured by user01 at Mon May 30 10:44:19 CEST 2016.

Summary of my perl5 (revision 5 version 25 subversion 2) configuration:
  Derived from: fbe0543bcbaefe00657a5aa89d684a59c352cb84
  Platform:
    osname=linux, osvers=4.5.0-0.bpo.2-amd64, archname=x86_64-linux
    uname='linux nyc3-186 4.5.0-0.bpo.2-amd64 #1 smp debian 4.5.3-2~bpo8+1 (2016-05-13) x86_64 gnulinux '
    config_args='-des -Dusedevel'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=undef, usemultiplicity=undef
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2',
    optimize='-O2',
    cppflags='-fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include'
    ccversion='', gccversion='4.9.2', gccosandvers=''
    intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678, doublekind=3
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16, longdblkind=3
    ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -fstack-protector-strong -L/usr/local/lib'
    libpth=/usr/local/lib /usr/lib/gcc/x86_64-linux-gnu/4.9/include-fixed /usr/include/x86_64-linux-gnu /usr/lib /lib/x86_64-linux-gnu /lib/../lib /usr/lib/x86_64-linux-gnu /usr/lib/../lib /lib
    libs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
    perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
    libc=libc-2.19.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.19'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
    cccdlflags='-fPIC', lddlflags='-shared -O2 -L/usr/local/lib -fstack-protector-strong'

Locally applied patches:
    uncommitted-changes


@INC for perl 5.25.2:
    lib
    /home/user01/perl5/lib/perl5
    /usr/local/lib/perl5/site_perl/5.25.2/x86_64-linux
    /usr/local/lib/perl5/site_perl/5.25.2
    /usr/local/lib/perl5/5.25.2/x86_64-linux
    /usr/local/lib/perl5/5.25.2
    .


Environment for perl 5.25.2:
    HOME=/home/user01
    LANG=en_US.utf8
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/home/user01/perl5/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
    PERL5LIB=/home/user01/perl5/lib/perl5
    PERL_BADLANG (unset)
    PERL_LOCAL_LIB_ROOT=/home/user01/perl5
    PERL_MB_OPT=--install_base "/home/user01/perl5"
    PERL_MM_OPT=INSTALL_BASE=/home/user01/perl5
    SHELL=/bin/bash

--------------1.40.perlbug
Content-Type: text/x-patch; name="0001-perlfunc.pod-text-update-on-open-function-encoding.patch"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="0001-perlfunc.pod-text-update-on-open-function-encoding.patch"

From 4801086fdc8748d2add2a8126d76397ac8c6de2f Mon Sep 17 00:00:00 2001
From: John Harig <john.harig@booking.com>
Date: Mon, 30 May 2016 10:59:04 +0200
Subject: [PATCH] perlfunc.pod text update on open function - :encoding


 pod/perlfunc.pod | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod
index 5c778f1..2104eac 100644
--- a/pod/perlfunc.pod
+++ b/pod/perlfunc.pod
@@ -4352,7 +4352,9 @@ three-argument form, then default layers stored in ${^OPEN} (see L<perlvar>;
 usually set by the L<open> pragma or the switch C<-CioD>) are ignored.
 Those layers will also be ignored if you specifying a colon with no name
 following it.  In that case the default layer for the operating system
-(:raw on Unix, :crlf on Windows) is used.
+(:raw on Unix, :crlf on Windows) is used. For clarification, C<:encoding> in
+the above example is a reference to the core module L<PerlIO::encoding>, and
+not to the deprecated (as of version 5.18) L<encoding> pragma.

 Open returns nonzero on success, the undefined value otherwise.  If
 the L<C<open>|/open FILEHANDLE,EXPR> involved a pipe, the return value
--
2.1.4


--------------1.40.perlbug--

________________________________________
From: karl williamson via RT [perlbug-followup@perl.org]
Sent: Saturday, May 28, 2016 7:03 PM
To: John Harig
Subject: Re: [perl #128245] 'perldoc -f open' :encoding clarification

On 05/26/2016 03:05 AM, John Harig (via RT) wrote:
> # New Ticket Created by  John Harig
> # Please include the string:  [perl #128245]
> # in the subject line of all future correspondence about this issue.
> # <URL: https://rt.perl.org/Ticket/Display.html?id=128245 >
>
>
> This is a bug report for perl from john.harig@booking.com,
> generated with the help of perlbug 1.40 running under perl 5.25.2.
>
>
> -----------------------------------------------------------------
> [Please describe your issue here]
>
> An example contained in 'perldoc -f open' states to use :encoding.
> When running 'perldoc encoding', it goes to a page for the encoding
> pragma which is deprecated as of 5.18.        However, the 'open' reference
> is actually to PerlIO::encoding.  To avoid confusion, I have added a
> phrase to the 'open' section of perlfunc.pm to avoid confusion.
>

This patch should be instead against pod/perlfunc.pod.
pan/Pod-Perldoc/corpus/perlfunc.pod is listed as a test file for
Pod::Perldoc.

I'll apply your patch if you instead redo it against perlfunc.  And do
you want your email listed as user01@NYC-186.booking.pcln.com?


On Sat May 28 10:03:06 2016, public@khwilliamson.com wrote:
> On 05/26/2016 03:05 AM, John Harig (via RT) wrote:
> > # New Ticket Created by  John Harig
> > # Please include the string:  [perl #128245]
> > # in the subject line of all future correspondence about this issue.
> > # <URL: https://rt.perl.org/Ticket/Display.html?id=128245 >
> >
> >
> > This is a bug report for perl from john.harig@booking.com,
> > generated with the help of perlbug 1.40 running under perl 5.25.2.
> >
> >
> > -----------------------------------------------------------------
> > [Please describe your issue here]
> >
> > An example contained in 'perldoc -f open' states to use :encoding.
> > When running 'perldoc encoding', it goes to a page for the encoding
> > pragma which is deprecated as of 5.18.	However, the 'open' reference
> > is actually to PerlIO::encoding.  To avoid confusion, I have added a
> > phrase to the 'open' section of perlfunc.pm to avoid confusion.
> >
> 
> This patch should be instead against pod/perlfunc.pod. 
> pan/Pod-Perldoc/corpus/perlfunc.pod is listed as a test file for 
> Pod::Perldoc.
> 
> I'll apply your patch if you instead redo it against perlfunc.  And do 
> you want your email listed as user01@NYC-186.booking.pcln.com?
> 



@p5pRT
Copy link
Author

p5pRT commented Jul 13, 2016

From john.harig@booking.com

0001-perlfunc.pod-text-update-on-open-function-encoding.patch
From 4801086fdc8748d2add2a8126d76397ac8c6de2f Mon Sep 17 00:00:00 2001
From: John Harig <john.harig@booking.com>
Date: Mon, 30 May 2016 10:59:04 +0200
Subject: [PATCH] perlfunc.pod text update on open function - :encoding

---
 pod/perlfunc.pod | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod
index 5c778f1..2104eac 100644
--- a/pod/perlfunc.pod
+++ b/pod/perlfunc.pod
@@ -4352,7 +4352,9 @@ three-argument form, then default layers stored in ${^OPEN} (see L<perlvar>;
 usually set by the L<open> pragma or the switch C<-CioD>) are ignored.
 Those layers will also be ignored if you specifying a colon with no name
 following it.  In that case the default layer for the operating system
-(:raw on Unix, :crlf on Windows) is used.
+(:raw on Unix, :crlf on Windows) is used. For clarification, C<:encoding> in
+the above example is a reference to the core module L<PerlIO::encoding>, and
+not to the deprecated (as of version 5.18) L<encoding> pragma.
 
 Open returns nonzero on success, the undefined value otherwise.  If
 the L<C<open>|/open FILEHANDLE,EXPR> involved a pipe, the return value
-- 
2.1.4

@khwilliamson
Copy link
Contributor

I (finally) applied Tony's patch as a933fcc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants