In this article we will cover the basics of installing perl modules with perl-CPAN.
Prerequisite:
You will need to have GNU C Compiler installed on your system. It can be installed by running the following command as root:
yum -y install gcc
The following steps should be run as root user.
First we need to install perl-CPAN with the following command:
yum -y install perl-CPANNow that we have perl-CPAN installed, we now have to configure it, or better yet, let it configure itself.
Run the following command:
cpanYou will be presented with the following:
CPAN is the world-wide archive of perl resources. It consists of about300 sites that all replicate the same contents around the globe. Manycountries have at least one CPAN site already. The resources found onCPAN are easily accessible with the CPAN.pm module. If you want to useCPAN.pm, lots of things have to be configured. Fortunately, most ofthem can be determined automatically. If you prefer the automaticconfiguration, answer 'yes' below.
If you prefer to enter a dialog instead, you can answer 'no' to thisquestion and I'll let you configure in small steps one thing after theother. (Note: you can revisit this dialog anytime later by typing 'oconf init' at the cpan prompt.)Would you like me to configure as much as possible automatically? [yes]Hitting enter will tell cpan to try to configure itself. (So hit enter)
The screen will scroll with a lot of information, then you will be presented with the following prompt (if all went well)
cpan[1]>This is the cpan shell prompt. From here it is simple to install all your perl modules. For this example we will install Term::ReadKey which is a small module that allows you to hide passwords typed on the command line in perl scripts.
At the cpan prompt (cpan[1]> )type the following:
cpan[1]> install Term::ReadKeyCPAN will not fetch the necessary files and install them for you.
NOTE: Some people have reported issues when using a proxy server. The simplest way around this is to export the http_proxy variable as root.
export http_proxy=http://fqdn_of_proxy.com:portexample:
export http_proxy=http://example.com:8080
If you use cpan a lot you can add the http_proxy variable to root .bashrc file so it will always be available without you typing the export command each time.
0 comments:
Post a Comment