Subject: | heredocs fail to terminate because of the leading space for verbatim blocks |
Including a heredoc in the synopsis causes a
"Can't find string terminator" error
when the code in the synopsis is in a verbatim block.
The problem is obvious:
the code is compiled with the leading spaces but the author usually
pretends they aren't there
so there's a disjoint between the heredoc start token and end token.
Trimming the entire block might could be problematic since the leading
space is arbitrary
(though trimming the whole block to the leading space of the first line
seems reasonable).
Changing my heredoc from
$string = <<HERE;
to
$string = <<' HERE';
works just fine (I indent with 2 spaces),
though it would probably cease working if this "bug" were ever fixed.
Though since this really should be an xt (release) test breaking
backward compatibility might not be so bad.
So mostly I just wanted to document the limitation and possible workaround
in case somebody else runs into it.