In perl.git, the branch smoke-me/alh/indented-heredocs has been created

<http://perl5.git.perl.org/perl.git/commitdiff/3404e68a979eae63254d7311d2526cc61216393d?hp=0000000000000000000000000000000000000000>

        at  3404e68a979eae63254d7311d2526cc61216393d (commit)

- Log -----------------------------------------------------------------
commit 3404e68a979eae63254d7311d2526cc61216393d
Author: Matthew Horsfall <wolfs...@gmail.com>
Date:   Fri Nov 11 06:35:32 2016 -0500

    Document Indented Here-docs

M       pod/perldiag.pod
M       pod/perlop.pod

commit ffd69cb1af65c730e9b446777f16a553b9b04904
Author: Matthew Horsfall <wolfs...@gmail.com>
Date:   Fri Nov 11 04:58:18 2016 -0500

    Add indented here-docs.
    
    This adds a new modifier '~' to here-docs that tells the parser
    that it should look for /^\s*$DELIM\n/ as the closing delimiter.
    
    These syntaxes are all supported:
    
      <<~EOF;
      <<~\EOF;
      <<~'EOF';
      <<~"EOF";
      <<~ 'EOF';
      <<~ "EOF";
    
    The '~' modifier will strip, from each line in the here-doc, the
    same whitespace that appears before the delimiter.
    
    Newlines will be copied as is, and lines that don't include the
    proper beginning whitespace will cause perl to croak.
    
    Some examples:
    
      if (1) {
        print <<~EOF;
          Hello there
          EOF
      }
    
    prints "Hello there\n";
    
    The following:
    
      if (1) {
        print <<~EOF;
         Hello There
          EOF
      }
    
    croaks with:
    
      Indentation on line 1 of here-doc doesn't match delimiter at - line 2.

M       pod/perldiag.pod
M       t/lib/warnings/toke
M       t/op/exec.t
M       t/op/heredoc.t
M       toke.c
-----------------------------------------------------------------------

--
Perl5 Master Repository

Reply via email to