-1

I'm new to Perl scripting language(beginner). What is the use of CPAN module,why we need this module? please let me know.

How install in CPAN in Linux(CentOS).

ram12393
  • 1,284
  • 3
  • 14
  • 29

3 Answers3

3

The CPAN module is useful for installing other modules from the Comprehensive Perl Archive Network (CPAN). You can use it like this (e.g. to install Exporter::Tiny from the CPAN):

perl -MCPAN -e'install Exporter::Tiny'

Though there are other tools available for installing modules from the CPAN. (For example, cpanminus which I'd recommend over the CPAN module.)

You probably don't need to install the CPAN module - it comes bundled with Perl itself, so unless CentOS (or Redhat upon which CentOS is based) has taken effort to remove it from their standard Perl package (which would not be without precedent - Redhat have removed modules from the standard Perl package before - much to many people's annoyance), you probably already have it. You can check if you've already got it like this:

perl -MCPAN -le'print $CPAN::VERSION'
tobyink
  • 13,478
  • 1
  • 23
  • 35
  • `[Ram@localhost ~]$ perl -MCPAN -le'print $CPAN::VERSION' Can't locate CPAN.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .). BEGIN failed--compilation aborted.` – ram12393 Dec 14 '13 at 05:53
  • It looks like (as I suggested might be the case) [RedHat has removed `CPAN` from their standard Perl package](http://forum.directadmin.com/showthread.php?t=42795). Try `sudo yum install perl-CPAN`. – tobyink Dec 14 '13 at 12:52
0

Also the use of the CPAN is very easy.In your prompt write cpan and then install Date::Simple to install the Date::Simple perl module or whichever module you need.

Fotis_zzz
  • 150
  • 1
  • 10
0

How install in CPAN in Linux(CentOS)

CPAN has been a part of the core Perl distribution since Perl 5.004 was released in 1997. It's very unlikely that you'll be using a version of Centos that doesn't already have it installed.

Dave Cross
  • 68,119
  • 3
  • 51
  • 97