KW.pm Perl Style Guides #24

Going beyond these Style Guides: 1

Coding Principles

  • OO Style

    • Accessor Methods instead of manipulating private variables directly

      • Can enforce encapsulation by putting private data/methods inside a closure

      • See Damian Conway's "OO Perl" book for more

    • Exception Handling

      • Roll your own with a "throw" method, or:

      • via CPAN modules such as Error or Exception

  • Argument checking via a standardized module:

    • put a big hunk of redundant code in one place

    • insure that all code has safe arguments.

    • CPAN modules such as Params::Validate or Getargs::Long

<< Previous | Index | Next >> Copyright © 2002 Daniel Allen