cpan command line utility

How to Installing Perl modules in Linux or Centos using cpan command line utility ?

Installing Perl modules in Linux , Fedora & Centos .

It’s easy to install Perl module in Linux using command line utility . you need to have root access on Linux machine to install Perl module using command line utility in linux or Centos .

If your logged in to Linux box using normal user account , you can switch to root user using  below command

[bsmith@demo]$ su -

Password:                     (provide root user password)

If you run CPAN command utility for the first time you will be asked series of question the default answer is fine . Once you find yourself starting at the cpan > command prompt installing a module is as easy as install MODULE::NAME - for example, to install the HTML::Template module you’d type:


# cpan> install HTML::Template

CPAN should take it from there and you’ll wind up with the module installed into your Perl library.

Let’s assume that your on your Linux system command line logged as root user and want to install a module quickly within Linux command prompt you can use below command:

# perl -MCPAN -e ‘install HTML::Template’

As I mentioned earlier, it’s always advisable to download a module yourself, especially if you’re having problems installing with CPAN. If you’re on the command line, you can use something like wget to grab the file. Next you’ll want to unzip it with something like:

# tar -zxvf HTML-Template-2.8.tar.gz

This will unzip the module into a directory, then you can move in and poke around – look for the README or INSTALL files. In most cases, installing a module by hand is still pretty easy, though (although not as easy as CPAN). Once you’ve switched into the base directory for the module, you should be able to get it installed by typing:

# perl Makefile.PL
# make
# make test
# make install


Both comments and pings are currently closed.

Comments are closed.

Copyright ©
Copyright © NewWpThemes Techmark Solutions -