Skip Menu |

This queue is for tickets about the PPR CPAN distribution.

Report information
The Basics
Id: 122794
Status: open
Priority: 0/
Queue: PPR

People
Owner: Nobody in particular
Requestors: arc [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: s///e RHS is not validated
Perl refuses to compile programs with syntax errors on the right-hand side of an s///e: $ perl -ce 's/./3 4/e' Number found where operator expected at -e line 1, near "3 4" (Missing operator before 4?) syntax error at -e line 1, near "3 4" -e had compilation errors. but PPR happily accepts them; it apparently ignores the /e flag. There are some very tricky cases hiding here; in particular, the RHS of the substitution can contain heredocs and formats and so on.
Subject: Re: [rt.cpan.org #122794] s///e RHS is not validated
Date: Mon, 14 Aug 2017 13:57:25 +0200
To: bug-PPR [...] rt.cpan.org
From: Damian Conway <damian [...] conway.org>
Show quoted text
> PPR happily accepts them; it apparently ignores the /e flag.
I'm close to a solution for that. Show quoted text
> There are some very tricky cases hiding here; in particular, > the RHS of the substitution can contain heredocs and formats and so on.
Indeed. That's why I'm still only "close". ;-) I'll report back as soon as "close" becomes "done". BTW, I doubt PPR will ever successfully parse s/.../.../ee or any greater number of e's, but I suspect that's an acceptable limitation. Damian
Subject: Re: [rt.cpan.org #122794] s///e RHS is not validated
Date: Mon, 21 Aug 2017 17:43:22 +0000
To: bug-PPR [...] rt.cpan.org
From: Damian Conway <damian [...] conway.org>
The 0.000012 release now handles (most) cases of s/.../.../e correctly, but still has some bad edge-cases. This is an extremely hard problem, which I may not be able to fully solve. I will continue to work on it, whenever inspiration strikes. Damian
On Mon Aug 21 13:44:13 2017, damian@conway.org wrote: Show quoted text
> The 0.000012 release now handles (most) cases of > s/.../.../e correctly, but still has some bad edge-cases. > This is an extremely hard problem, which I may not be > able to fully solve. I will continue to work on it, whenever > inspiration strikes. > > Damian
Good luck! This is something that even Perl cannot get right all the time. Consider this example: s/ /<<END /e END / If you search for the third / you find that there is an /e flag which means that we have a here-doc whose body is " /e\n". But if that /e is part of the here-doc body, then the / at the end must be the one that terminates the s///, in which case, since there is no /e there, we do *not* have a here-doc. I can see why Perl 6 moved the flags.
Subject: Re: [rt.cpan.org #122794] s///e RHS is not validated
Date: Wed, 23 Aug 2017 05:53:16 +0000
To: bug-PPR [...] rt.cpan.org
From: Damian Conway <damian [...] conway.org>
Show quoted text
> Good luck! This is something that even Perl cannot get right all the
time. Indeed. I don't really expect to get this 100% right, especially not in a single pass using regexes. But it's actually heartening to know that it's literally *impossible* to get right. ;-) Show quoted text
> Consider this example:
What a great/terrible example. Thank-you! Show quoted text
> I can see why Perl 6 moved the flags.
We should have been braver...and removed heredocs! They require over 100 lines in the regex just to parse them, and the need to parse them slows the regex down considerably at every newline. :-( Thank-you for the feedback, though. I plan to add your example to my talk on the module. Damian