Page tree
Skip to end of metadata
Go to start of metadata

 

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:

  1. Create a Perl module.

    • Save your custom module as the /usr/local/cpanel/Cpanel/API/Module.pm file, where Module 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.
    • UAPI modules reside in the Cpanel::API namespace.
  2. Add functions to your module.
    • A single module generally contains many functions.
    • You can cause functions to only work with certain feature lists.
  3. Thoroughly test your module on a non-production server.

Additional resources

For more information about how to write Perl modules, we recommend the following resources: