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:
- Unpack the source into a temporary area.
- perl Makefile.PL
- make
- make test
- make install