Zera Modules
A look into the Zera Modules
Each Zera module is composed of 5 Perl modules and the html templates.
- Controller.pm
- View.pm
- Actions.pm
- API.pm
- Components.pm
- tmpl/*.html
Controller.pm
It is used for special functions that affect any of the other 3 modules.
View.pm
This creates the HTML views on each module. By default it shows the content on the display_home function, but also can have more functions that can be accessed though URL as long as they start with "display_".
Actions.pm
It is user for DB actions or any other logic. Each one of its functions starts with "do_" and corresponds with the same function in View.pm. So, if you want to add some actions to what's been shown in display_edit in View.pm, you need to create a function called do_edit.
API.pm
This module is used only if you require any API rest interface.
Components.pm
This module is used to create small HTML sections that can be included in any view or template.
tmpl/*.html
The tmpl folder is used to store all the HTML templates that are used by the View.pm and/or Components.pm files. The name of the files must be identical to the functions that they corresponds. So, if you have a function called display_content in View.pm, you need to create a template called display_content.html and insert in there the HTML code of what you want to show.