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

split docs don't mention pattern modifiers #15379

Closed
p5pRT opened this issue May 31, 2016 · 10 comments
Closed

split docs don't mention pattern modifiers #15379

p5pRT opened this issue May 31, 2016 · 10 comments

Comments

@p5pRT
Copy link

p5pRT commented May 31, 2016

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

Searchable as RT128302$

@p5pRT
Copy link
Author

p5pRT commented May 31, 2016

From @Smylers

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


perldoc -f split doesn't state that split /PATTERN/ can use pattern
modifier flags, but it seems that it can​:

  ./perl -Ilib -E 'say foreach split /a b # c/, q[0aB1a b # c2a B # c 3]'
  0aB1
  2a B # c 3

  ./perl -Ilib -E 'say foreach split /a b # c/ix, q[0aB1a b # c2a B # c 3]'
  0
  1a b # c2a B # c 3

This should be included in split's documention.

Are all the qr/PATTERN/ flags also valid on split? (With the already
documented exception that /^/ implies /^/m anyway.)



Flags​:
  category=docs
  severity=low


Site configuration information for perl 5.25.2​:

Configured by smylers at Tue May 31 13​:40​:14 BST 2016.

Summary of my perl5 (revision 5 version 25 subversion 2) configuration​:
  Commit id​: bdc905d
  Platform​:
  osname=linux, osvers=3.13.0-85-generic, archname=x86_64-linux
  uname='linux fozzie 3.13.0-85-generic #129-ubuntu smp thu mar 17 20​:50​:15 utc 2016 x86_64 x86_64 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 -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
  optimize='-O2',
  cppflags='-fwrapv -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
  ccversion='', gccversion='4.8.4', 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 -L/usr/local/lib'
  libpth=/usr/local/lib /usr/lib/gcc/x86_64-linux-gnu/4.8/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'


@​INC for perl 5.25.2​:
  lib
  /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/smylers
  LANG=en_GB.utf8
  LANGUAGE=en_GB​:en
  LC_COLLATE=C
  LD_LIBRARY_PATH (unset)
  LOGDIR (unset)
  PATH=/home/smylers/bin​:/usr/local/sbin​:/usr/local/bin​:/sbin​:/bin​:/usr/sbin​:/usr/bin​:/usr/X11R6/bin​:/usr/games
  PERL_BADLANG (unset)
  PERL_CPANM_OPT=--sudo --prompt
  SHELL=/bin/bash

@p5pRT
Copy link
Author

p5pRT commented May 31, 2016

From @Abigail

On Tue, May 31, 2016 at 09​:06​:57AM -0700, Smylers wrote​:

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

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

-----------------------------------------------------------------
perldoc -f split doesn't state that split /PATTERN/ can use pattern
modifier flags, but it seems that it can​:

./perl -Ilib -E 'say foreach split /a b # c/, q[0aB1a b # c2a B # c 3]'
0aB1
2a B # c 3

./perl -Ilib -E 'say foreach split /a b # c/ix, q[0aB1a b # c2a B # c 3]'
0
1a b # c2a B # c 3

This should be included in split's documention.

Are all the qr/PATTERN/ flags also valid on split? (With the already
documented exception that /^/ implies /^/m anyway.)

I think they are, but some warn. For instance​:

  $ perl -wE 'our @​a = split /f/g, "foo"'
  Use of /g modifier is meaningless in split at -e line 1.
  $

But I haven't checked all of them.

Abigail

@p5pRT
Copy link
Author

p5pRT commented May 31, 2016

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

@p5pRT
Copy link
Author

p5pRT commented May 31, 2016

From @Smylers

Abigail writes​:

On Tue, May 31, 2016 at 09​:06​:57AM -0700, Smylers wrote​:

Are all the qr/PATTERN/ flags also valid on split?

I think they are, but some warn. For instance​:

$ perl -wE 'our @​a = split /f/g, "foo"'
Use of /g modifier is meaningless in split at -e line 1.

/g is an m// modifier. perlop documents that m// takes all of the qr//
modifiers plus /g and /c.

But I haven't checked all of them.

I was hoping that somebody might already know, but if not I'll go
through them.

Smylers

@p5pRT
Copy link
Author

p5pRT commented May 31, 2016

From @cpansprout

On Tue May 31 13​:59​:22 2016, smylers@​stripey.com wrote​:

Abigail writes​:

On Tue, May 31, 2016 at 09​:06​:57AM -0700, Smylers wrote​:

Are all the qr/PATTERN/ flags also valid on split?

I think they are, but some warn. For instance​:

$ perl -wE 'our @​a = split /f/g, "foo"'
Use of /g modifier is meaningless in split at -e line 1.

/g is an m// modifier. perlop documents that m// takes all of the qr//
modifiers plus /g and /c.

But I haven't checked all of them.

I was hoping that somebody might already know, but if not I'll go
through them.

It does accept all the modifiers that m// accepts, because there is actually an m// op there at compile time initially, before ck_split makes its exotic changes to the op tree. After all, you can write split m//....

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented May 31, 2016

From @cpansprout

On Tue May 31 14​:14​:16 2016, sprout wrote​:

On Tue May 31 13​:59​:22 2016, smylers@​stripey.com wrote​:

Abigail writes​:

On Tue, May 31, 2016 at 09​:06​:57AM -0700, Smylers wrote​:

Are all the qr/PATTERN/ flags also valid on split?

I think they are, but some warn. For instance​:

$ perl -wE 'our @​a = split /f/g, "foo"'
Use of /g modifier is meaningless in split at -e line 1.

/g is an m// modifier. perlop documents that m// takes all of the
qr//
modifiers plus /g and /c.

But I haven't checked all of them.

I was hoping that somebody might already know, but if not I'll go
through them.

It does accept all the modifiers that m// accepts, because there is
actually an m// op there at compile time initially, before ck_split
makes its exotic changes to the op tree. After all, you can write
split m//....

If you do change the docs, please don’t make it imply that split "foo" can take modifiers. split per se does not actually take any, but rather the m// that serves as its first argument. (In fact, the idea of split taking modifiers is not a way I have ever looked at it, even before I knew perl internals.)

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Mar 6, 2017

From @khwilliamson

Thanks for reporting this.

I did some investigation, and added the documentation in
9285d0d
--
Karl Williamson

@p5pRT
Copy link
Author

p5pRT commented Mar 6, 2017

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

@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