On Thu, Jun 27, 2013 at 05:48:55PM +0100, Nicholas Clark wrote: > On Thu, Jun 27, 2013 at 05:32:58PM +0100, Dave Mitchell wrote: > > On Wed, Jun 26, 2013 at 11:24:49PM -0400, Ricardo Signes wrote: > > > I hope it turns out that there is a way to repair R::G for 5.18.0. I've sent > > > Damian an email about this yesterday, and I'm copying him on this one. > > > Hopefully we can begin a dialog about the specific problems and how they might > > > be addressed. > > > > > > Well, if Damian can point out specific behavioural deficiencies in > > code blocks and qr constant overloading, I'm happy to attempt to address > > them. > > > > Note however that R::G, as was implemented, specifically relied on a bug in > > the old perl implementation that allowed code blocks contained in strings > > (rather than in regexes) to be interpolated into regexes and be executed, > > without requiring a 'use re eval' in scope. > > But this was the only bug that it was relying on? > > ie that the code should still be able to work if 'use re eval' is added to > the scopes in which it it is used? > > (I stress the *should* in the above question) IIRC, the issue was that R::G was using qr-constant overloading to get at the constant strings within user's //'s, and return the constant bits plus pieces of added in code. If the R::G's overload method were to return a qr// containing the string plus code, rather than returning a string, then things should Just Work (tm). No need even for 'use re eval' except that buggy old perls require it. So something like this. Uncomment one of the three 'return' lines: BEGIN { use overload; overload::constant 'qr' => sub { # works in 5.16; fails in 5.18 return "(?{ print qq{whee!\n} })$_[0]"; # works in 5.18; fails in 5.16 return qr/(?{ print qq{whee!\n} })$_[0]/; # works in 5.16, 5.18 use re 'eval'; return qr/(?{ print qq{whee!\n} })$_[0]/; }; } "foobar" =~ /bar/ or die; -- Please note that ash-trays are provided for the use of smokers, whereas the floor is provided for the use of all patrons. -- Bill RoystonThread Previous | Thread Next