I suppose that #={ } would work like a normal Pod block which does not
allow implicit code. That way you could keep it properly indented by
default:

class Foo;
method bar ($x, $y) {
    #={Swaps $x and $y}
    ...
}

method baz ($a, @b) {
    #={
    Takes $a, applies it to the values in @b
    Bla bla bla
    }
    ...
}

I remember reading that #{} comments are not allowed at the beginning
of a line. Is that still true? Would that also apply to #={} ? If so,
it would be easy to make a mistake:

class Foo;
#={ This class does something neat }  <-- ILLEGAL

method bar () { ...}

Another issue is that Pod directives must be at the beginning of a
line. That would mean having to break the indent in cases like:

method baz ($a, @b) {
    #={
    Takes $a, applies it to the values in @b
    Be mindful of the following:

=item This
=item That
=item And the other thing
    }
    ...
}

Could Perl allow Pod blocks to be indented in #={ } comments? Maybe
the "local" beginning-of-line in the comment could be considered to be
at the position where the #={ appeared, or at the position of the
first whitespace character after it.. If so, then maybe the "no
implicit code blocks" restriction could be lifted, so the whole
comment behaves just like an indented =pod block:

method baz ($a, @b) {
    #={
    Takes $a, applies it to the values in @b
    Be mindful of the following:

    =item This
    =item That
    =item And the other thing

      This is rendered as code, since it is more indented further
      than the initial #={
    }
    ...
}

Thoughts?

Reply via email to