develooper Front page | perl.perl5.porters | Postings from June 2016

Re: Indented here docs?

Thread Previous | Thread Next
From:
Abigail
Date:
June 30, 2016 19:28
Subject:
Re: Indented here docs?
Message ID:
20160630193010.GB8117@almanda.fritz.box
On Thu, Jun 30, 2016 at 01:50:19PM -0400, Matthew Horsfall (alh) wrote:
> On Thu, Jun 30, 2016 at 1:43 PM, Matthew Horsfall (alh)
> <wolfsage@gmail.com> wrote:
> > Oh, no I just got my regexp wrong, yours is correct :)
> 
> The attached makes that use case work (whoops!).


\o/

> 
> -- Matthew Horsfall (alh)

> From 7189b92486eb576dabd8fa75f466ccc72d16550b Mon Sep 17 00:00:00 2001
> From: Matthew Horsfall <wolfsage@gmail.com>
> Date: Thu, 30 Jun 2016 09:25:23 -0400
> Subject: [PATCH] Allow indented heredocs (no string stripping yet).
> 
> This adds new syntax:
> 
>   <<~EOF;
>   <<~'EOF';
>   <<~"EOF";
> 
> The ~ tells the parser that it should look for /^\s+EOF\n/ as the
> closing delimiter.
> 
> This allows:
> 
>   print <<~EOF;
>     The string EOF
>     can exist inside this string
>   EOF
> 
> No support for stripping off indentation from the heredoc yet though.



Are you planning to make that happen soon [1]? Else we're stuck with a
feature which cannot be changed anymore, and, IMO, this is far more
useful if indentation is stripped off.


[1] soon as "before the next major release".


Abigail

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