Konstantin Narkhov
Pheix 0.8.96
@condemnedcell
konstantinnarkhov.pro

Notes about perl coding rules, pt.1

9 June, 2017

I would like to post a few notes about coding rules, which I have to follow during programming. These rules appeared after some attempts to remove smell from the code of Pheix. Of course, this text was influenced by the great book “Perl Best Practices” by Damian Conway.

Requirements for names of system & application modules

Pheix modules are located in the admin/libs/modules. There are two types of modules: system (for example, admin/libs/modules/Pheix) and application (for example, admin/libs/modules/Shopcat).

System module contains:

  1. Module package (*.pm);
  2. Module descriptor (*.xml);

Application module contains:

  1. Module packages (*.pm, master package and few slave packages) ;
  2. Module descriptor (*.xml);
  3. Activity container (*.pl).

Modules are included by expression use Module::Package; and this fact sets up requirements for names of files and directories: Module –  module directory, Package – module package name.

Requirements for module directory (module name):

  • Name should be less than or equal to 6 characters;
  • Name should consist of one significant word (or abbreviation, for example Feedbk);
  • Name should begin with upper case character;
  • Name should contain only one upper case character – first character;
  • Name should contain only characters: [A-Za-z];

Requirements for module package name:

  • Name should be less than or equal to 6 characters;
  • Name should consist of one or few significant words (abbreviations are allowed, for example IoUtil);
  • Name should begin with upper case characters;
  • Name should be in CamelCase style, i.e. every significant word in name starts with upper case letter;
  • Name should contain only characters: [A-Za-z];

Names of (master) module package, module descriptor and activity container should be equal (difference in file extension).

Administrator and visitor front-ends

CMS Pheix has two different front-ends: one for administrator (or moderator) & other for visitor. Administrator front-end is supplied by modules at admin/libs/modules, and visitor front-end is supplied by modules at libs/modules. As I’ve said above all modules are classified into system modules or application modules.

Blog entries

Check out latest blog entries: most interesting stories about past events & activities.

Quick feedback

Letters and spaces only