develooper Front page | perl.perl5.porters | Postings from August 2012

[perl #3636] heredoc in s///e replacement

Thread Previous | Thread Next
From:
Father Chrysostomos via RT
Date:
August 19, 2012 14:42
Subject:
[perl #3636] heredoc in s///e replacement
Message ID:
rt-3.6.HEAD-11172-1345412562-1781.3636-15-0@perl.org
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


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

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