develooper Front page | perl.perl5.porters | Postings from September 2019

[perl #133822] split pattern allows barewords under use strict'subs'

From:
Tony Cook via RT
Date:
September 11, 2019 07:00
Subject:
[perl #133822] split pattern allows barewords under use strict'subs'
Message ID:
rt-4.0.24-16786-1568185226-1971.133822-15-0@perl.org
On Tue, 05 Feb 2019 14:29:36 -0800, tonyc wrote:
> On Tue, 05 Feb 2019 03:29:06 -0800, hv wrote:
> > On Mon, 04 Feb 2019 21:01:46 -0800, tonyc wrote:
> > > On Mon, 04 Feb 2019 15:09:29 -0800, grinnz@gmail.com wrote:
> > > > The first argument to split appears to allow a bareword and
> > > > interprets it
> > > > as a string with no error, even with strict 'subs' active. This is
> > > > at the
> > > > very least undocumented.
> > > >
> > > > perl -E'use strict; say for split foo, "barfoobar"'
> > > >
> > > > The unary + does not even affect the behavior.
> > > >
> > > > perl -E'use strict; say for split +foo, "barfoobar"'
> > >
> > > Fix attached.
> > >
> > > Tony
> > 
> > I note that this bug has been present a long time (at least as far
> > back as 5.10), so fixing it may cause substantial breakage. My
> > inclination would be to document it, and look for a lower-risk way to
> > make the fix available (eg  starting with a deprecation warning).
> 
> I wasn't planning on applying it before 5.31.
> 
> As a bug fix I'm not sure it needs a deprecation cycle.
> 
> Tony

Here's a deprecation patch.

Tony

---
via perlbug:  queue: perl5 status: open
https://rt.perl.org/Ticket/Display.html?id=133822



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