Knowledgebase

Back to Troubleshooting

Installing Perl modules


This article is for cPanel Accounts. Determine where your account is with this guide.

This guide is for advanced users who feel comfortable using commands to install Perl modules in their cPanel account.


Perl modules are collections of functions that allow you to perform tasks in Perl. You will need to install a Perl module before you can use it inside a Perl script. Perl is supported on all of our Shared servers, however, the access to the Perl Module installer is disabled in cPanel, due to it requiring the C compiler. However, the C compiler is disabled on all of our shared servers as it is a high-security threat.

Still, it is possible to install any Perl module via the command line without the C compiler enabled. You can do it using the SSH connection, please contact support to have shell access enabled in your cPanel, if it is not already.

We will use the cpan command to install Perl modules. You can find the full list of available CPAN modules in the official documentation.

1. Once logging into the shell console, type cpan to access the CPAN console.

2. To install a Perl module with CPAN, the syntax is as follows:

CPAN module install syntax
install module::name

As an example, we will attempt to install the Date::Calc module:

3. You will most likely see this error at the end of the attempt:

Cpan is configured to provide one setting to Makefile.PL, and Makefile.PL is picking up a conflicting setting from the environment.

Cpan Prefix is pre-configured as PREFIX=/home/USER/perl/usr

However, our servers' environments are configured to use a different directory.

As such, you can tell Cpan to stop specifying PREFIX. In the cpan shell, run these commands:

o conf makepl_arg ''
 
o conf mbuildpl_arg ''
 
o conf commit
 
o conf make_arg ''
 
o conf commit

4. Now you will be able to run install module::name again. A successful installation log looks like the following:

Some Perl modules may have dependencies on other modules and cannot be installed without them or a specific version of them. The installation may ask to install 1 or more modules that have a dependence.


5. After the installation do not forget to type exit in the cpan console to close it and remove the lock file:

After this, you have successfully installed Perl modules to use in your scripts!


If you come across any issues during this process, please open a new chat or create a support ticket with our help team.




Related Articles

How To Know If My Server Is Down
Account Suspension Help
How To Fix A Broken Website
How To Resolve The HTTP Error 403 Forbidden
How To Restore An SQL Database In cPanel

Can’t Find what you need?

No worries, Our experts are here to help.