Custom modules can define additional hookable events for the Standardized Hooks System. In essence, the system treats non-cPanel code that runs as a cPanel process as a native hookable event.
Your custom module must meet the following minimum requirements for hookable events:
The calling code must be part of cPanel & WHM's runtime process (for example, a cPanel or WHM plugin).
It should be possible to leverage the Standardized Hooks System outside of cPanel processes; however, certain features, such as privilege escalation, will not work and will likely encounter errors. Generally speaking, we do not recommend using Standardized Hooks outside of a cPanel process.
- The calling code must be Perl and must use the
We recommend that developers observe the following practices for consistency and expectations:
- In your custom code, bookend the primary logic with both a
poststage. Most cPanel-provided hookable events include these stages.
prestages, observe the return value and do not perform the primary logic. While the Standardized Hooks System will handle the rollback actions, the caller must not allow the requested event to occur.
poststages to occur in a meaningful way with respect to the primary logic. Usually, this you must dispatch the
poststage and provide a dataset that clearly shows whether the primary logic completed successfully.
The following Perl module includes custom hookable events: