YAPC::NA 2004 Perl Style Guides for Large Projects #28

Going beyond these Style Guides: 1

Coding Principles

  • Accessor Methods instead of manipulating private variables directly

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

    • See the Alpaca Book (Learning Perl Objects, References, & Modules, by Randal Schwartz & Tom Phoenix)

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

  • Exception Handling

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

    • via CPAN modules such as Error or Exception

  • Function/Method Parameter Checking:

    • 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 © 2004 Daniel Allen