Closed p5pRT closed 20 years ago
Trawling through old messages\, I found this aside in http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/1999-01/msg01423.html
The following code gives the same results with all perls I've checked after 5.004 up to and including bleadperl (it fails to find the end of the heredoc in 5.004 and earlier):
crypt% ./perl -wl $_ = "test"; s/t/\<\<E/eg; "new" E print __END__ "new" es "new"
crypt%
Hugo
On Fri\, Aug 04\, 2000 at 01:37:12PM +0100\, Hugo wrote:
Trawling through old messages\, I found this aside in http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/1999-01/msg01423.html
The following code gives the same results with all perls I've checked after 5.004 up to and including bleadperl (it fails to find the end of the heredoc in 5.004 and earlier):
crypt% ./perl -wl $_ = "test"; s/t/\<\<E/eg; "new" E print __END__ "new" es "new"
crypt%
What is the bug?
Ronald
iHugo \hv@​crypt\.compulink\.co\.uk wrote
The following code gives the same results with all perls I've checked after 5.004 up to and including bleadperl (it fails to find the end of the heredoc in 5.004 and earlier):
I agree with Ronald that I see no bug here. But this area is clearly full of possibilities
$ ./perl -wl $_ = 'test'; s/t/\<\<E . 'fgh' dddd eeee E . 'ijk'/eg; print; __END__ ^D Can't find string terminator "E" anywhere before EOF at - line 2. $
Note that the CTRL/D was needed - the __END__ wasn't seen.
Mike Guy
I wrote
Note that the CTRL/D was needed - the __END__ wasn't seen.
I should have made clear that this one *is* a bug.
And that it happens with bleadperl.
Mike Guy
In \20000804093955\.B476438@​linguist\.dartmouth\.edu\, Ronald J Kimball writes: :On Fri\, Aug 04\, 2000 at 01:37:12PM +0100\, Hugo wrote: :> Trawling through old messages\, I found this aside in :> http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/1999-01/msg01423.ht :ml :> :> The following code gives the same results with all perls I've checked :> after 5.004 up to and including bleadperl (it fails to find the end of :> the heredoc in 5.004 and earlier): :> :> crypt% ./perl -wl :> $_ = "test"; :> s/t/\<\<E/eg; :> "new" :> E :> print :> __END__ :> "new" :> es "new" :> :> crypt% : :What is the bug?
Gak\, it's my head. I'm expecting the string to eval-and-replace to be qq{ "new"\n}\, to become qq{new} after eval: it seems wrong that the string should be qq{\<\<E}\, since in that case it seems like the compiler should not know to attribute the heredoc to it. But I have a nasty suspicion that the compiler not knowing that was a bug I fixed myself a mere sprinkling of eons ago.
I've probably been getting too much sleep\, or something.
Hugo
On Fri\, Aug 04\, 2000 at 06:21:12PM +0100\, Hugo wrote:
In \20000804093955\.B476438@​linguist\.dartmouth\.edu\, Ronald J Kimball writes: :On Fri\, Aug 04\, 2000 at 01:37:12PM +0100\, Hugo wrote: :> crypt% ./perl -wl :> $_ = "test"; :> s/t/\<\<E/eg; :> "new" :> E :> print :> __END__ :> "new" :> es "new" :> :> crypt% : :What is the bug?
Gak\, it's my head. I'm expecting the string to eval-and-replace to be qq{ "new"\n}\, to become qq{new} after eval:
That's the result you would get if you added another /e.
Compare to this:
$E = \<\<E; "new" E $_ = "test"; s/t/$E/eg; print;
$_="test"; s/t/$E/eeg; print;
Ronald
iI wrote
I agree with Ronald that I see no bug here. But this area is clearly full of possibilities
$ ./perl -wl $_ = 'test'; s/t/\<\<E . 'fgh' dddd eeee E . 'ijk'/eg; print; __END__ ^D Can't find string terminator "E" anywhere before EOF at - line 2. $
Having thought further about this case\, and also contemplated the code to see how one might go about "mending" it\, I've come to the conclusion that it's a feature rather than a bug and that a doc fix is appropriate.
Patch is for bleadperl.
Mike Guy
On Sun Aug 06 23:02:25 2000\, RT_System wrote:
iI wrote
I agree with Ronald that I see no bug here. But this area is clearly full of possibilities
$ ./perl -wl $_ = 'test'; s/t/\<\<E . 'fgh' dddd eeee E . 'ijk'/eg; print; __END__ ^D Can't find string terminator "E" anywhere before EOF at - line 2. $
Having thought further about this case\, and also contemplated the code to see how one might go about "mending" it\, I've come to the conclusion that it's a feature rather than a bug and that a doc fix is appropriate.
Patch is for bleadperl.
Mike Guy
--- ./pod/perldata.pod.orig Tue Aug 1 03:32:02 2000 +++ ./pod/perldata.pod Mon Aug 7 13:54:41 2000 @@ -462\,6 +462\,22 @@ down from the door where it began. FINIS
+If you use a here-doc within a delimited construct\, such as in C\<s///eg>\, +the quoted material must come on the lines following the final delimiter. +So instead of + + s/this/\<\<E . 'that' + the other + E + . 'more '/eg; + +you have to write + + s/this/\<\<E . 'that' + . 'more '/eg; + the other + E + =head2 List value constructors
List values are denoted by separating individual values by commas
End of patch
Well thatâs very interesting. That was never applied\, which I think is fortunate\, as Larry Wall specifically made nested here-docs *not* work that way in commit fd2d09532.
--
Father Chrysostomos
On Sat Aug 18 23:32:16 2012\, sprout wrote:
On Sun Aug 06 23:02:25 2000\, RT_System wrote:
iI wrote
I agree with Ronald that I see no bug here. But this area is clearly full of possibilities
$ ./perl -wl $_ = 'test'; s/t/\<\<E . 'fgh' dddd eeee E . 'ijk'/eg; print; __END__ ^D Can't find string terminator "E" anywhere before EOF at - line 2. $
Having thought further about this case\, and also contemplated the code to see how one might go about "mending" it\, I've come to the conclusion that it's a feature rather than a bug and that a doc fix is appropriate.
Patch is for bleadperl.
Mike Guy
--- ./pod/perldata.pod.orig Tue Aug 1 03:32:02 2000 +++ ./pod/perldata.pod Mon Aug 7 13:54:41 2000 @@ -462\,6 +462\,22 @@ down from the door where it began. FINIS
+If you use a here-doc within a delimited construct\, such as in C\<s///eg>\, +the quoted material must come on the lines following the final delimiter. +So instead of + + s/this/\<\<E . 'that' + the other + E + . 'more '/eg; + +you have to write + + s/this/\<\<E . 'that' + . 'more '/eg; + the other + E + =head2 List value constructors
List values are denoted by separating individual values by commas
End of patch
Well thatâs very interesting. That was never applied\,
Actually\, it *was* applied\, as 8bd33e3ebe. But it has never been fully true.
which I think is fortunate\, as Larry Wall specifically made nested here-docs *not* work that way in commit fd2d09532.
And it wasnât just nested here-docs. It was here-docs inside any quoted construct. That was accidentally broken later on in a2c066523a\, except in string evals (or multiple levels of nested quotes)\, where here-docs fully nested in quote-like operators continued to work\, the crash introduced in 0244c3a403 (which only crashed for s/// without /e) notwithstanding.
So I think we should remove that documentation.
--
Father Chrysostomos
* Father Chrysostomos via RT \perlbug\-followup@​perl\.org [2012-08-19T17:42:42]
And it wasnât just nested here-docs. It was here-docs inside any quoted construct. That was accidentally broken later on in a2c066523a\, except in string evals (or multiple levels of nested quotes)\, where here-docs fully nested in quote-like operators continued to work\, the crash introduced in 0244c3a403 (which only crashed for s/// without /e) notwithstanding.
So I think we should remove that documentation.
I believe I understand correctly\, and therefore agree.
-- rjbs
On Sun Jul 21 13:35:12 2013\, perl.p5p@rjbs.manxome.org wrote:
* Father Chrysostomos via RT \perlbug\-followup@​perl\.org [2012-08- 19T17:42:42]
And it wasnât just nested here-docs. It was here-docs inside any quoted construct. That was accidentally broken later on in a2c066523a\, except in string evals (or multiple levels of nested quotes)\, where here- docs fully nested in quote-like operators continued to work\, the crash introduced in 0244c3a403 (which only crashed for s/// without /e) notwithstanding.
So I think we should remove that documentation.
I believe I understand correctly\, and therefore agree.
I did so in 1bf4876033. BTW\, have you seen \https://rt-archive.perl.org/perl5/Ticket/Display.html?id=109744#txn-1230929 yet?
--
Father Chrysostomos
Migrated from rt.perl.org#3636 (status was 'resolved')
Searchable as RT3636$