Introduction
You can add custom modules to cPanel & WHM and call them with UAPI.
Warning:
Make certain that you thoroughly test custom modules before you attempt to add them to production servers.
Steps to create a custom module
To create a custom module and add it to cPanel & WHM's UAPI, perform the following steps:
-
Create a Perl module.
-
Save your custom module as the
/usr/local/cpanel/Cpanel/API/Module.pm
file, whereModule
is the custom module's name.Warning:
cPanel & WHM treats all of the modules in the
/usr/local/cpanel/Cpanel/API/
directory as UAPI modules.- We recommend that you only save module files (
.pm
) to this location. - The presence of other files may cause problems, even if the files relate to your custom modules.
- We recommend that you only save module files (
- UAPI modules reside in the
Cpanel::API
namespace.
-
- Add functions to your module.
- A single module generally contains many functions.
- You can cause functions to only work with certain feature lists.
- Thoroughly test your module on a non-production server.