develooper Front page | perl.perl5.porters | Postings from March 2013

[perl #116823] Regexp::Grammars broken since 5.17.1

Thread Previous | Thread Next
From:
Andrew Rodland via RT
Date:
March 3, 2013 06:10
Subject:
[perl #116823] Regexp::Grammars broken since 5.17.1
Message ID:
rt-3.6.HEAD-28177-1362281180-1207.116823-15-0@perl.org
On Sat Mar 02 16:38:19 2013, davem wrote:
> On Sun, Feb 17, 2013 at 10:07:37PM -0800, Andrew Rodland wrote:
> > Regexp::Grammars fails all of its tests beginning with perl 5.17.1
> due to
> > the reworking of (?{...}) and (??{...}) in that version. The tests
> all fail
> > with "Eval-group not allowed at runtime, use re 'eval'" and real
> code using
> > Regexp::Grammars is expected to fail in the same way.
> >
> > Regexp::Grammars works by using overload::constant qr to bless all
> qr's in
> > its scope into objects that have overloaded qq, which then does all
> kinds of
> > string replacements on the pattern to turn it into one brimming with
> > (??{...}) constructs. In previous versions of perl, this worked fine
> > (possibly because all of the overload mojo wasn't considered
> "runtime"), but
> > now it's broken.
> >
> > I'm not sure if this is to be considered a bug in perl, or if the
> *previous*
> > behavior was a bug. If this is not a perl bug, how can
> Regexp::Grammars fix
> > itself without requiring its users to pepper their code with use re
> 'eval'?
> 
> Given that Regexp/Grammars.pm is 6000+ lines of code, is it possible
> to
> supply a short test script (with no external dependencies) that uses
> overload::constant qr and overloaded qq in such a way that
> demonstrates
> the changed behaviour?
> 
> Thanks.
> 

I distilled it down as far as I could in the attached file. Here's a 
snippet of "perlbrew exec perl rgtest.pl":

perl-5.14.1
==========
ok 1 - It matches
ok 2 - Code ran
1..2


perl-5.16.2
==========
ok 1 - It matches
ok 2 - Code ran
1..2


perl-5.16.2@ss
==========
ok 1 - It matches
ok 2 - Code ran
1..2


perl-5.17.0
==========
ok 1 - It matches
ok 2 - Code ran
1..2


perl-5.17.1
==========
Eval-group not allowed at runtime, use re 'eval' in regex m/(?{ 
$RGP::Success = 1 })foo/ at rgtest.pl line 27.


perl-5.17.8
==========
Eval-group not allowed at runtime, use re 'eval' in regex m/(?{ 
$RGP::Success = 1 })foo/ at rgtest.pl line 27.

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

Thread Previous | Thread Next


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