Difference between revisions of "Cpan"

From Linuxintro
imported>ThorstenStaerk
 
Line 11: Line 11:
  
 
= Usecase =
 
= Usecase =
If you run a [[perl]] [[program]] and get the error message
+
If you run a [[perl]] program and get the error message
 
  Can't locate ''Net/DAV/Server.pm'' in @INC (@INC contains: /usr/lib/perl5/5.8.8/x86_
 
  Can't locate ''Net/DAV/Server.pm'' in @INC (@INC contains: /usr/lib/perl5/5.8.8/x86_
 
  64-linux-thread-multi /usr/lib/perl5/5.8.8 /usr/lib/perl5/site_perl/5.8.8/x86_64
 
  64-linux-thread-multi /usr/lib/perl5/5.8.8 /usr/lib/perl5/site_perl/5.8.8/x86_64
Line 21: Line 21:
 
  # perl -mCPAN -e CPAN::shell
 
  # perl -mCPAN -e CPAN::shell
 
  cpan> install ''Net::Dav::Server''
 
  cpan> install ''Net::Dav::Server''
 +
 +
= Delete a module =
 +
There are various reasons why you would want to delete a module, e.g. because you have called
 +
install X11::Protocol
 +
from a wrong place and you did not get the window shown, so it is mis-configured. If this happens to you, delete the module manually, e.g.
 +
rm -rf /usr/lib/perl5/site_perl/5.10.0/X11
  
 
= See also =
 
= See also =
 
* [[pear]] - same stuff for [[php]]
 
* [[pear]] - same stuff for [[php]]
 
* [http://www.cpan.org www.cpan.org]
 
* [http://www.cpan.org www.cpan.org]

Latest revision as of 15:08, 13 March 2011

CPAN is an acronym for Comprehensive Perl Archive Network. It allows for downloading perl modules from the web.

Run CPAN like this:

# perl -mCPAN -e CPAN::shell
cpan> install Foo::Bar

e.g.

cpan> install Math::XOR

You'll run that as root if your Perl is installed in a system-wide location. The first time you run that first command, you'll be prompted a number of questions to initially configure the module. For most of them, you just hit ENTER to accept the default.

Usecase

If you run a perl program and get the error message

Can't locate Net/DAV/Server.pm in @INC (@INC contains: /usr/lib/perl5/5.8.8/x86_
64-linux-thread-multi /usr/lib/perl5/5.8.8 /usr/lib/perl5/site_perl/5.8.8/x86_64
-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr
/lib/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/vendor_per
l/5.8.8 /usr/lib/perl5/vendor_perl .) at ./__webdav.pl line 14.
BEGIN failed--compilation aborted at ./__webdav.pl line 14.

You see it's time to install Net::Dav::Server.

# perl -mCPAN -e CPAN::shell
cpan> install Net::Dav::Server

Delete a module

There are various reasons why you would want to delete a module, e.g. because you have called

install X11::Protocol

from a wrong place and you did not get the window shown, so it is mis-configured. If this happens to you, delete the module manually, e.g.

rm -rf /usr/lib/perl5/site_perl/5.10.0/X11

See also