How to install a module from CPAN



perl -MCPAN -e shell
I always seem to forget this simple syntax, so I thought it would be good to post it where I can find it. Where else, my blog -- by the way, this is another excellent use for blogs. Not only do we publish information for others to find, but occasionally a blog is the best place to put frequently accessed info that the author may need. At least I know the source is reliable. :-)

How do I install a module from CPAN?
The easiest way is to have a module also named CPAN do it for you. This module comes with perl version 5.004 and later.

To get a cpan shell, try either cpan:

Linux:

  $ cpan

Windows:

 C:\>cpan

or the more complete command:

$perl -MCPAN -e shell

Terminal does not support AddHistory.

cpan shell -- CPAN exploration and modules installation (v1.7601)

ReadLine support available (try 'install Bundle::CPAN')

cpan>

The first time the command runs, it will prompt for a series of configuration questions.
Now, within the shell, you can install a module
 
 cpan> install Some::Module 

To manually install the CPAN module, or any well-behaved CPAN module for that matter, follow these steps:

  1. Unpack the source into a temporary area.

  2. perl Makefile.PL

  3. make

  4. make test

  5. make install
If your version of perl is compiled without dynamic loading, then you just need to replace step 3 (make) with make perl and you will get a new perl binary with your extension linked in.

Comments

Popular posts from this blog

Ping Multiple Hosts Using Bash Nmap and Fping

How to Obtain Bitcoin and Other Cryptocurrencies

Using nmap to Generate Host Lists