http://www.perlmonks.org?node_id=226580


in reply to Documenting Methods/Subs


TMTOWTDI,

If i'm going to comment my code (which i only do for something which others will have to see and/or maintain) than i use the following setup which i have derived from my coding experiences:

## # Function: get_input # Receives: nothing # Returns : user input regarding previous menu, Taint checked and chom +ped. # Notes : none ##
The notes area will explain any code that isn't self-documenting before one gets to the code. The "receives" and "returns" sections detail what will be set up before and after the function runs (pre/post-conditions). However, due to my idiosyncracies, they are usually pragmatic pre/post-conditions, not solid theoretical ones. When the code is written well it's only four lines. When it's not i'll have huge sections describing what's going on, which is usually when i decide to re-write it :-)

Anyway, there's another $0.02 for your hat,
jynx