Perl modules allow you to extend cPanel & WHM’s functionality. For example, you can use Perl modules to add functions to cPanel & WHM.
Warning:
Before you install a module, make certain that it functions in a cPanel-provided Perl environment. For more information, read our Guide to Perl in cPanel & WHM documentation.
Note:
In the examples throughout this document, Module::Name is the name of the custom Perl module that you wish to install.
Install modules to the system Perl binary
To install a Perl module to the system’s Perl environment (/usr/bin/perl), use one of the following methods:
Install from the WHM interface
To install a module to the system Perl environment, use WHM’s Install a Perl Module interface (WHM » Home » Software » Install a Perl Module).
Note:
To use this interface, you must have compiler access. For more information, read our Compiler Access documentation.
Install from the command line via script
The /usr/local/cpanel/scripts/perlinstaller script requires that you include, as an argument, the name of the module that you wish to install. Make certain that you use the CPAN convention for the module name.
Note:
When you run this script without arguments, you will enter an interactive shell that lets you fully manage CPAN module installations.
When you run this script, you can include the --force flag. This flag causes the system to ignore errors and warnings, and can result in the installation of broken modules.
The CPAN utility on your server is the cPanel & WHM version of the App::cpanminus application. For more information, read the cpanminus documentation.
The cpan command calls the CPAN utility. You must include, as an argument, the name of the module that you wish to install. Make certain that you use the CPAN convention for the module name.
Example
cpan Module::Name
Install modules to the cPanel & WHM Perl installation
To install a Perl module to the cPanel-included Perl installation (/usr/local/cpanel/3rdparty/bin/perl), use the following method:
The cpanm script
When you the /usr/local/cpanel/bin/cpanm script, you must include, as an argument, the name of the module that you wish to install.
Make certain that you use the CPAN convention for the module name.
Include the -i argument to indicate that you wish to install the module.
You can use this script to install a Perl module with minimal interaction.
Example
/usr/local/cpanel/bin/cpanm -i Module::Name
Confirm that your module installed correctly
Perl binary
To confirm that the modules installed to the system’s Perl binary function, run the following command. In this example, Module::Name is the name of the module:
The system will return the installed module’s version number.
cPanel-included Perl installation
To confirm that the modules installed to the cPanel-included Perl installation function, run the following command. In this example, Module::Name is the name of the module:
The system will return the installed module’s version number.
Manage installed modules
The /usr/local/cpanel/scripts/perlmods script allows you to use the Perl::Mod module in order to manage the modules on your system. Use the following flags to troubleshoot module installations:
-l — Use the Perl::Mod module to list all of the installed modules for your system.
-s — Use the Perl::Mod module to search for an installed module.
-u — Use the Perl::Mod module to uninstall modules.
Troubleshoot module problems
Error logs
Error logs provide additional insight into problems on your server. cPanel & WHM writes STDERR (standard error) output to the /usr/local/cpanel/logs/error_log file whenever it encounters an error.
Use the strace command
Some errors require the strace (system trace) command to view additional output that does not write to the /usr/local/cpanel/logs/error_log file. To view this output, run the following command during the system error: