There are various ways to download and install perl modules from CPAN. In general it’s a good idea to download and install the perl module but we will see the different ways of installing the perl module.
1. The easiest way is to use the perl CPAN module. SSH to the server as root and execute:
If you are running this for the first time, it will prompt you for a few questions (default answers are fine) before providing you with the “cpan >” prompt. To install a module, say for example “Perl::OSType”, execute
# cpan > install Perl::OSType
this will download and compile the module and install it server wide. To know more commands/options of cpan, type question mark ( ? ) at the cpan prompt.
2. The second and the quickest method is to use perl CPAN module from the bash prompt instead of ‘cpan’ prompt. If you are on the command line of Linux, just execute
# perl -MCPAN -e ‘install Perl::OSType’
3. The above 2 methods are the easiest one but it is recommended to install the module manually as the above methods may not always work. You can search the module at http://search.cpan.org/ and then wget it on your server. Once done, extract it:
# tar -zxf Perl-OSType-1.002.tar.gz
There is a standard way of installing the perl module, however, you will see a README file inside the extracted directory containing the installation steps. Goto the extracted directory and execute
# perl Makefile.PL
# make test
# make install
Or you can use perl module installer script as well.
It’s simplest to install a perl module from the shell:
# /scripts/perlinstaller module
# /scripts/perlinstaller Inline::C
If you’re not sure of the module name, you can search for it on cpan:
Or you can use Perl Module Installer in WHM;
This WHM feature allows you to download and install a Perl module. It works by providing an interface that lets you search through the central Perl repository known as CPAN (http://www.cpan.org). WHM then returns a list of Perl modules that match your search criteria, allowing you to click on any of the relevant search results to download and install the module.
To search for and install a Perl module:
1. Enter your search criteria into the available text field. Alternatively:
You can also view a list of Perl modules available from CPAN by clicking Show Available Perl Module(s). The list is limited, however; an exhaustive list is available at http://www.cpan.org.
If you know the exact name of the module you wish to install, you may install it by entering its name in the Install a Perl Module text box and clicking Install Now.
2. Click Go.
WHM will display the matching Module Name, Version, Description, and any Actions you may perform.
3. Click the Install button next to the module you would like to download and install.
You may also view a module’s documentation by clicking its corresponding Show Docs button.
If you did not find the desired module, you may continue searching from the search results page using the Search field and Go button.