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

<http://perl5.git.perl.org/perl.git/commitdiff/88bec374e26a712ba22ac26783e5c01af48e83fc?hp=0000000000000000000000000000000000000000>

        at  88bec374e26a712ba22ac26783e5c01af48e83fc (commit)

- Log -----------------------------------------------------------------
commit 88bec374e26a712ba22ac26783e5c01af48e83fc
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 efc8877c1929b7a4b258190cad555dd8187ac369
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;
    
    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

commit 122e761a2a3c3cbfc6c25ab5be8674ffa7cad50c
Author: Matthew Horsfall <wolfs...@gmail.com>
Date:   Sat Nov 12 09:24:24 2016 -0500

    Allow spaces between << and delimiter in here-doc
    
    Previusly the following program would fail:
    
      print << EOF;
      hi
      EOF
    
    Like so:
    
      Use of bare << to mean <<"" is deprecated at test.pl line 1.
      Bareword found where operator expected at test.pl line 1, near "EOF"
            (Missing operator before EOF?)
      syntax error at test.pl line 1, near "EOF"
      Execution of test.pl aborted due to compilation errors.
    
    This seemed strange because we allow:
    
      << 'EOF';
      << "EOF":
      << `EOF`;
    
    Now, "<< EOF" and "<< \EOF" work just like the others do.

M       t/op/heredoc.t
M       toke.c
-----------------------------------------------------------------------

--
Perl5 Master Repository

Reply via email to