Perl - Code Organization

  • As noted in the section outlining Comments & External Documentation, each file should begin with a block comment detailing important information about the file. In addition to the information outlined in the previous section, you should also include the following information:
    • All global variables used. Group as specified below.
    • Any modules/packages that are utilized by the script
    • Any external files that were included or parsed within the file
    • A list of procedures and a brief description of what each does.
    • If the page produces HTML output, be sure to information about any client-side files that are included (i.e., JavaScript, CSS, etc.)1)
  • Constants should be defined at the beginning of the file.
  • Any global variables should be declared after declaring constants.
  • All external file inclusion should be done at the beginning of the file. If necessary, define variables to store the file path and name after the declaration of global variables and use that variable later for the inclusion.
  • Any functions should be present after declaring global variables.
  • All procedural code should be present after all functions have been declared and coded.
1) It should be noted that any HTML produced by a Perl script should adhere to the HTML standards.
 
programming\perl\code_organization · Last modified: 2008/01/22 17:36 by admin
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki