|
The source is fairly well documented, but here are a few starting points:
All scripts must
The first thing that any script should do is call
All templates are retrieved using
All text not coming from the database or a template file is in the file
All output is handled by
Most error handling is done with
All SQL statements are handled by All SQL result tuples are retrieved as hash references. While there is a penalty for this, it eliminates brittle positional dependence. All SQL statements use explicit column lists instead of *. Also eliminates brittle positional dependence.
To exit the program, call Time in the DatabaseTo avoid having to code a special case for every supported database, time is stored as a string containing unix time rather than DB-native timestamp types. This avoids a lot of mess and makes the application itself 2038-compliant. Coding ConventionsEmphasis is on legibility and maintainability rather than trick compact code. This codebase is designed to be as hack-accessible as possible to as many people as possible. Since a lot of people know a little bit about Perl, the use of certain language features has been foregone in the interest of general grokability. ReciPants does not use object oriented-ish conventions or some of the more powerful or terse but less-understood library functions and syntax. It avoids excessively nested function calls, makes order of operations explicit with parentheses in spite of operator precedence, uses globals, and brute forces certain operations that could be made more efficient for the computer, but less efficient to understand. This is on purpose. ReciPants uses bottom-up design. Blocks are indented with tabs, and tabs only. Tab stops are set to 4. Every function has a comment block above it stating its arguments, return value, and a brief description of what it does.
Local copies of global variables and local variables with the otherwise same
names as globals start with
Functions that are only accessed from one script stay in that
file; functions that are used by more than one script go in
|