Install Perl modules via cpan


CPAN – Comprehensive Perl Archive Network which contains large collection of perl modules.

You can easily install perl modules using cpan shell just like you install packages using yum or apt.

What are the requirements for cpan ?

  • C Compiler
  • Perl
  • Root privileges

Hope you already have met the requirements, lets move forward with configuring cpan and installing modules.

From the command prompt execute the following command to enter the cpan shell.

#perl -MCPAN -e shell

For the first time when the command is invoked, you will be prompted to configure cpan manually or automatically. Most of the configuration can be detected automatically. So, lets go with automatic configuration by typing “yes”  for the question asked by cpan shell.

You will be greeted with a cpan shell within few seconds.

If you want reconfigure cpan manually/automatically,  execute the command “o conf init”  without quotes in cpan shell.

Now, how to install perl module ? Enter the following command in cpan shell.

cpan>install <module name>

cpan>install ExtUtils::MakeMaker

To install forcefully :

cpan> force install HTML::Mason

Type “h” to get help from cpan shell.

Hope it helps!