Install Perl module using CPAN

How to install Perl module using CPAN. How to include the module in a program?

Questions by Tanu_shree   answers by Tanu_shree

Showing Answers 1 - 22 of 22 Answers

maityar

  • Sep 22nd, 2008
 

Try this command from DOX or UNIX Prompt. You will get a CPAN Prompt. To install a module use install modulename.

perl -MCPAN -e shell

Hope this help.

  Was this answer useful?  Yes

Get in to console prompt and follow as below

> CPAN   to get the cpan prompt

CPAN > INSTALL <Module > which ask you for the dependency modules if required to get install along with the current. Proceed to yes or enter key module will get installed.

  Was this answer useful?  Yes

mattperl

  • Sep 30th, 2010
 

Even though the above answers work as well, I prefer to type cpan at the command prompt and it brings up the cpan shell prompt. I am using Linux and it may be OS dependent...

  Was this answer useful?  Yes

Lucky Behl

  • Mar 18th, 2011
 

It can be possible that th CPAN module is already not installed. So at the first you need to do the installatiuon in a traditional way:-

1. Take a desired module's tar.gz version from the CAPN.
2. Extract & unzip it.
3. Upon this you will find that there is a directory with the module name in your PWD.
4. Perform the following actions :-

Go the new created module directory:-

Build module
----------------------

% perl5 Makefile.PL
% make


Install Module
----------------------
% make test
% make install
% make clean

Makefile.PL will be there in the extracted/ unzipped directroy already.

you can substitute perl Makefile.PL PREFIX=/my/perl_directory to install the modules into /my/perl_directory.

One note: CPAN shell install the dependencies as well but this method wont do that. Check the module dependencies from the CPAN module dependencies link

Kuldip Singh Behal

  Was this answer useful?  Yes

ankitloud

  • Nov 20th, 2011
 

I think the best option will be : type following command on command prompt

cpan App::cpanminus then you can install any module using its name using following command

cpan Module::Apache

let me know if it doesn't work

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions