develooper Front page | perl.perl5.porters | Postings from December 2012

Re: [perl #116086] split "\x20" doesn't work as documented

Thread Previous
From:
Nicholas Clark
Date:
December 14, 2012 14:25
Subject:
Re: [perl #116086] split "\x20" doesn't work as documented
Message ID:
20121214142529.GM5653@plum.flirble.org
On Fri, Dec 14, 2012 at 06:19:01AM -0800, Father Chrysostomos via RT wrote:
> On Fri Dec 14 05:07:24 2012, davem wrote:

> > I can confirm that it broke between 5.17.4 and 5.17.5:
> > 
> > $ perl5174  -e 'print "[$_]\n" for split  "\x20", " a b  c " '
> > [a]
> > [b]
> > [c]
> > $ perl5175  -e 'print "[$_]\n" for split  "\x20", " a b  c " '
> > []
> > [a]
> > [b]
> > []
> > [c]
> > $
> > 
> > and that the old behaviour worked back until at least 5_004_05.
> 
> I probably broke that (unintentionally).

.../Porting/bisect.pl --target miniperl -e '@a = split "\x20", " a b  c "; die if @a > 3'

thinks that you're right:

commit 5255171e6cd0accee6f76ea2980e32b3b5b8e171
Author: Father Chrysostomos <sprout@cpan.org>
Date:   Sat Sep 22 17:54:12 2012 -0700

    [perl #94490] const fold should not trigger special split " "

    The easiest way to fix this was to move the special handling out of
    the regexp engine.  Now a flag is set on the split op itself for
    this case.  A real regexp is still created, as that is the most
    convenient way to propagate locale settings, and it prevents the
    need to rework pp_split to handle a null regexp.

    This also means that custom regexp plugins no longer need to handle
    split specially (which they all do currently).


I'm surprised that there wasn't a regression test that caught this.

Nicholas Clark

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About