Allow indented SQL heredoc marker#216
Conversation
In properly indented code it is nicer to be able to do
my $a = << " SQL"
SELECT something FROM somewhere
SQL
avoiding the need to put the second 'SQL' without whitespace prefix, but this requires the inclusion of the white space in the here document terminator.
|
@NickHibma: Thanks for the pull request. Is your documentation example correct? Shouldn't the end of the heredoc be indented? I'm kind of itchy about this idea. Something seems weird about this idea, but I'm not sure I can put my finger on it. |
|
I've fixed the example. And yes, there is something wrong with adding the whitespace in the terminator. But having your indenting screwed up doesn't cut it either. I usually use quoting operators instead because of it. In shell scripts you can use |
|
worth revisiting a recent |
|
@gedge I believe that form of indentation is already handled by vim-perl |
|
Er, sorry - I realized once I hit "Comment" that you may have been suggesting this to the PR author as an alternative to whitespace-prefixing their heredoc delimiter! |
|
If code cleanliness is the goal with indented SQL statements, it is possible to use an empty heredoc marker which means the indenting problem goes away: I suspect you always have an empty newline after every SQL statement anyway, so it is quite natural to format the code this way. An empty end of line marker may scare some people, but I thought i would throw it out as an alternative. |
In properly indented code it is nicer to be able to do
avoiding the need to put the second 'SQL' without whitespace prefix, but this requires the inclusion of the white space in the here document terminator.