Perl: How do I install Perl modules? eg. Installing LWP module for Perl.
The easiest way to install Perl modules is by installing them through “shell”. Let us say that you are trying to install very common module called: LWP
You can test to see if you have LWP installed by typing:
perl -MLWP -le "print(LWP->VERSION)"
If you get something like: Can’t locate LWP.pm in @INC means that you don’t have it installed. To install LWP, type:
perl -MCPAN -eshell
NOTE: most times it is okey for you to accept default answers to questions cpan asks.
You can read through cpan help by typing “h” without the quotes at cpan> prompt.
To continue installing LWP, type:
install Bundle::LWP
After few questions, and some text scrolling, you will have LWP installed. If for some reason you don’t want to do it this way, you can always obtain source for the module you are trying to install and build it from source files. You can obtain these files from CPAN site



getting error by intalling perl module
new to linux cpan
# perl -MCPAN -eshell
Terminal does not support AddHistory.
cpan shell — CPAN exploration and modules installation (v1.7602)
ReadLine support available (try ‘install Bundle::CPAN’)
cpan> install Bundle::LWP
CPAN: Storable loaded ok
Going to read /usr/src/perll/asterisk-perl-0.05/yes/sources/authors/01mailrc.txt.gz
yes: invalid option — -
Try `yes –help’ for more information.
Going to read /usr/src/perll/asterisk-perl-0.05/yes/sources/modules/02packages.details.txt.gz
yes: invalid option — -
Try `yes –help’ for more information.
Warning: Your /usr/src/perll/asterisk-perl-0.05/yes/sources/modules/02packages.details.txt.gz does not contain a Line-Count header.
Please check the validity of the index file by comparing it to more
than one CPAN mirror. I’ll continue but problems seem likely to
happen.
Warning: Your /usr/src/perll/asterisk-perl-0.05/yes/sources/modules/02packages.details.txt.gz does not contain a Last-Updated header.
Please check the validity of the index file by comparing it to more
than one CPAN mirror. I’ll continue but problems seem likely to
happen.
Going to read /usr/src/perll/asterisk-perl-0.05/yes/sources/modules/03modlist.data.gz
yes: invalid option — -
Try `yes –help’ for more information.
Can’t locate object method “data” via package “CPAN::Modulelist” (perhaps you forgot to load “CPAN::Modulelist”?) at (eval 20) line 1.
at /usr/lib/perl5/5.8.8/CPAN.pm line 3405
CPAN::Index::rd_modlist(’CPAN::Index’, ‘/usr/src/perll/asterisk-perl-0.05/yes/sources/modules/03modli…’) called at /usr/lib/perl5/5.8.8/CPAN.pm line 3128
CPAN::Index::reload(’CPAN::Index’) called at /usr/lib/perl5/5.8.8/CPAN.pm line 785
CPAN::instance(’CPAN=HASH(0×89a12bc)’, ‘CPAN::Bundle’, ‘Bundle::DBI’) called at /usr/lib/perl5/5.8.8/CPAN.pm line 1427
CPAN::Shell::local_bundles(’CPAN::Shell’) called at /usr/lib/perl5/5.8.8/CPAN.pm line 1835
CPAN::Shell::expandany(’CPAN::Shell’, ‘Bundle::LWP’) called at /usr/lib/perl5/5.8.8/CPAN.pm line 2077
CPAN::Shell::rematein(’CPAN::Shell’, ‘install’, ‘Bundle::LWP’) called at /usr/lib/perl5/5.8.8/CPAN.pm line 2164
CPAN::Shell::install(’CPAN::Shell’, ‘Bundle::LWP’) called at /usr/lib/perl5/5.8.8/CPAN.pm line 201
eval {…} called at /usr/lib/perl5/5.8.8/CPAN.pm line 201
CPAN::shell() called at -e line 1
cpan>
don’t know what to do
will anybody guide
install Bundle::CPAN <- try that and see if it works.
What flavor of linux are you using?
[...] those prerequisites. We will use perl’s cpan shell to get this installed (visit my post on how to install perl modules for more details). If it is your first time starting this up, you will have to answer some [...]