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 perlsyn continues to mention split in scalar context clobbers @_ (a feature removed in Perl 5.12) #15611

Closed
p5pRT opened this issue Sep 18, 2016 · 8 comments

Comments

@p5pRT
Copy link

p5pRT commented Sep 18, 2016

Migrated from rt.perl.org#129297 (status was 'resolved')

Searchable as RT129297$

@p5pRT
Copy link
Author

p5pRT commented Sep 18, 2016

From daoswald@gmail.com

This is a bug report for perl from daoswald@​gmail.com, generated with the
help of perlbug 1.40 running under perl 5.22.0.


perldoc perlsyn mentions the following​:

"And the split gets called in scalar context so it starts scribbling on
your @​_ parameter list. Ouch!"

The example code that leads up to this comment shows​:

  func(@​foo);
  func( split /​:/ );

The assertion that split in scalar context will scribble on @​_ was true up
to Perl 5.10.x, but removed officially in 5.12.0. So at minimum the
documentation should drop that statement.

It may also be worthwhile to provide example code that doesn't use split.
Maybe a grep example would be useful, since grep in scalar context provides
different return semantics than in list context. Another possible
replacement example could use a pattern match with /g, since again list
context would result in different behavior than scalar context.


--- Flags​: category=docs severity=low --- Site configuration information
for perl 5.22.0​: Configured by doswald at Fri Nov 6 23​:37​:24 MST 2015.
Summary of my perl5 (revision 5 version 22 subversion 0) configuration​:
Platform​: osname=linux, osvers=4.2.0-17-generic, archname=x86_64-linux
uname='linux doswald-hp-pavilion-dv7-notebook-pc 4.2.0-17-generic
#21-ubuntu smp fri oct 23 19​:56​:16 utc 2015 x86_64 x86_64 x86_64 gnulinux '
config_args='-de -Dprefix=/home/doswald/perl5/perlbrew/perls/perl-5.22.0
-Aeval​:scriptdir=/home/doswald/perl5/perlbrew/perls/perl-5.22.0/bin'
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',
optimize='-O2', cppflags='-fwrapv -fno-strict-aliasing -pipe
-fstack-protector-strong -I/usr/local/include' ccversion='',
gccversion='5.2.1 20151010', 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/5/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.21.so, so=so, useshrplib=false, libperl=libperl.a
gnulibc_version='2.21' 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​:
Devel​::PatchPerl 1.38 --- @​INC for perl 5.22.0​:
/home/doswald/.perlbrew/libs/perl-5.22.0@​std/lib/perl5/x86_64-linux
/home/doswald/.perlbrew/libs/perl-5.22.0@​std/lib/perl5
/home/doswald/perl5/perlbrew/perls/perl-5.22.0/lib/site_perl/5.22.0/x86_64-linux
/home/doswald/perl5/perlbrew/perls/perl-5.22.0/lib/site_perl/5.22.0
/home/doswald/perl5/perlbrew/perls/perl-5.22.0/lib/5.22.0/x86_64-linux
/home/doswald/perl5/perlbrew/perls/perl-5.22.0/lib/5.22.0 . --- Environment
for perl 5.22.0​: HOME=/home/doswald LANG=en_US.UTF-8 LANGUAGE=en_US
LD_LIBRARY_PATH (unset) LOGDIR (unset)
PATH=/home/doswald/bin​:/home/doswald/.perlbrew/libs/perl-5.22.0@​std/bin​:/home/doswald/perl5/perlbrew/bin​:/home/doswald/perl5/perlbrew/perls/perl-5.22.0/bin​:/home/doswald/bin​:/usr/local/sbin​:/usr/local/bin​:/usr/sbin​:/usr/bin​:/sbin​:/bin​:/usr/games​:/usr/local/games​:/snap/bin
PERL5LIB=/home/doswald/.perlbrew/libs/perl-5.22.0@​std/lib/perl5
PERLBREW_BASHRC_VERSION=0.75 PERLBREW_HOME=/home/doswald/.perlbrew
PERLBREW_LIB=std
PERLBREW_MANPATH=/home/doswald/.perlbrew/libs/perl-5.22.0@​std/man​:/home/doswald/perl5/perlbrew/perls/perl-5.22.0/man
PERLBREW_PATH=/home/doswald/.perlbrew/libs/perl-5.22.0@​std/bin​:/home/doswald/perl5/perlbrew/bin​:/home/doswald/perl5/perlbrew/perls/perl-5.22.0/bin
PERLBREW_PERL=perl-5.22.0 PERLBREW_ROOT=/home/doswald/perl5/perlbrew
PERLBREW_VERSION=0.75 PERL_BADLANG (unset)
PERL_LOCAL_LIB_ROOT=/home/doswald/.perlbrew/libs/perl-5.22.0@​std
PERL_MB_OPT=--install_base /home/doswald/.perlbrew/libs/perl-5.22.0@​std
PERL_MM_OPT=INSTALL_BASE=/home/doswald/.perlbrew/libs/perl-5.22.0@​std
SHELL=/bin/bash

@p5pRT
Copy link
Author

p5pRT commented Sep 18, 2016

From daoswald@gmail.com

--
Apologies, that should have been reported against perlsub, not perlsyn.
--
David Oswald
davido@​cpan.org

@p5pRT
Copy link
Author

p5pRT commented Sep 18, 2016

From @mauke

On Sun Sep 18 00​:19​:13 2016, daoswald wrote​:

--
Apologies, that should have been reported against perlsub, not perlsyn.

Patched in f260647.

@p5pRT
Copy link
Author

p5pRT commented Sep 18, 2016

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

@p5pRT
Copy link
Author

p5pRT commented Sep 18, 2016

@mauke - Status changed from 'open' to 'pending release'

@p5pRT
Copy link
Author

p5pRT commented Sep 18, 2016

From @ap

* l.mai@​web.de via RT <perlbug-followup@​perl.org> [2016-09-18 10​:00]​:

Patched in f260647.

And also in e463df9.

The misfeature was removed in a6d8037
and its documentation dropped without replacement, even though it now
constitutes a portability gotcha for people targeting both new and old
perls. Even today, 5.10 and even 5.8 remain widely deployed.

@p5pRT
Copy link
Author

p5pRT commented May 30, 2017

From @khwilliamson

Thank you for filing this report. You have helped make Perl better.

With the release today of Perl 5.26.0, this and 210 other issues have been
resolved.

Perl 5.26.0 may be downloaded via​:
https://metacpan.org/release/XSAWYERX/perl-5.26.0

If you find that the problem persists, feel free to reopen this ticket.

@p5pRT
Copy link
Author

p5pRT commented May 30, 2017

@khwilliamson - Status changed from 'pending release' to 'resolved'

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

No branches or pull requests

1 participant