There is no such thing as too much documentation, no matter how redundant it may be.

Whew! Obviously you haven't seen the code I have.

use warnings; # turn warnings on use CGI; # use Stein's CGI.pm for parsing params my $q = new CGI; # create the CGI.pm instance # get the customer's name (in the name parameter) # place in in variable $customer_name my $customer_name = $q->param("name") # if the customer's name is "Bobby" # print "Hi Bobby" if ($customer_name eq "Bobby") { print "Hi Bobby\n"; } else { # if not, print "You're not Bobby" print "You're not Bobby\n"; }

Get the point? This completely distracts from the code and takes way more time on the part of the programmer.

As for subs, I say one comment directly above them. Anymore and the sub is too long and should be broken into multiple subs.


In reply to Re: Re: Documenting Methods/Subs by Anonymous Monk
in thread Documenting Methods/Subs by vek

Title:
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, details, 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, summary, 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.