Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
I think it's useful to boil down what's already been said or referred to.
  • POD is the official way to do multi line comments in Perl, whether you think of it as as a work-around or not (which varies),
  • use "=for comment" or "=begin/end comment" for stuff that's just comments and shouldn't show up in the output text when documentation is extracted from the code, such as when you run perldoc on the program,
  • You can't indent the "=for comment", so it's not quite like other language's multiline comments, and
  • You do need a "=cut" at the end to get back to code. (I think this might be your main objection to using POD, and, yes, you're stuck with it).
The last item may change with Perl6, for "=begin/end", but the rest will probably not. See Apocalypse 2 RFC 5

Here's an example which you can runn with "perl" and with "perldoc" to see what shows up where. Note that in many places, such as before the "=cut", the blank line is part of the syntax.

=head1 This is text that shows up with the "perldoc" command. The comment sections below do not. =cut print "hello\n"; =for comment This is a single paragraph of comment text, spanning multiple lines. It ends with the first blank line. After that, the text is inuded with other printed pod text that shows up with perldoc This text also shows up with perldoc, it's not part of the "for" comment above. =cut print "hello1\n"; =for comment Another paragraph of comment text, spanning multiple lines. It ends with the first blank line. =cut print "hello2\n"; =begin comment This is a multi-paragraph comment section. Which is terminated by an =end comment on a line by itself. This is a second paragraph =end comment =cut print "hello3\n"; =head2 Other pod documentation This is text that also shows up with the "perldoc" command. The comment sections above do not. =cut print "hello4\n"

In reply to Re: Multi-line comments in perl code? by rodion
in thread Multi-line comments in perl code? by mrguy123

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others about the Monastery: (2)
    As of 2020-08-09 09:24 GMT
    Find Nodes?
      Voting Booth?
      Which rocket would you take to Mars?

      Results (54 votes). Check out past polls.