FAQ 8.45 How do I install a module from CPAN?



This is an excerpt from the latest version perlfaq8.pod, which
comes with the standard Perl distribution. These postings aim to
reduce the number of repeated questions as well as allow the community
to review and update the answers. The latest version of the complete
perlfaq is at http://faq.perl.org .

--------------------------------------------------------------------

8.45: How do I install a module from CPAN?

The easiest way is to have a module also named CPAN do it for you. This
module comes with perl version 5.004 and later.

$ perl -MCPAN -e shell

cpan shell -- CPAN exploration and modules installation (v1.59_54)
ReadLine support enabled

cpan> install Some::Module

To manually install the CPAN module, or any well-behaved CPAN module for
that matter, follow these steps:

1 Unpack the source into a temporary area.

2
perl Makefile.PL

3
make

4
make test

5
make install

If your version of perl is compiled without dynamic loading, then you
just need to replace step 3 (make) with make perl and you will get a new
perl binary with your extension linked in.

See ExtUtils::MakeMaker for more details on building extensions. See
also the next question, "What's the difference between require and
use?".



--------------------------------------------------------------------

The perlfaq-workers, a group of volunteers, maintain the perlfaq. They
are not necessarily experts in every domain where Perl might show up,
so please include as much information as possible and relevant in any
corrections. The perlfaq-workers also don't have access to every
operating system or platform, so please include relevant details for
corrections to examples that do not work on particular platforms.
Working code is greatly appreciated.

If you'd like to help maintain the perlfaq, see the details in
perlfaq.pod.
.



Relevant Pages

  • Re: Installing DBD::File via CPAN
    ... Do you use 'UNINST=1' in the build options for CPAN? ... >> Did you build Perl from source, or install via a RPM or binary distro? ... >>> sender of the delivery error by replying to this message, or notify us ...
    (perl.dbi.users)
  • RE: Installing DBD::File via CPAN
    ... Subject: Installing DBD::File via CPAN ... This is Perl 5.8.7 ... ReadLine support available (try 'install Bundle::CPAN') ...
    (perl.dbi.users)
  • FAQ 8.47 How do I keep my own module/library directory?
    ... tell Perl where to install the modules. ... cpan> o conf commit ... The perlfaq-workers, a group of volunteers, maintain the perlfaq. ...
    (comp.lang.perl.misc)
  • FAQ 8.47 How do I keep my own module/library directory?
    ... tell Perl where to install the modules. ... cpan> o conf commit ... The perlfaq-workers, a group of volunteers, maintain the perlfaq. ...
    (comp.lang.perl.misc)
  • Installing DBD::File via CPAN
    ... This is Perl 5.8.7 ... cpan shell -- CPAN exploration and modules installation ... ReadLine support available (try 'install Bundle::CPAN') ...
    (perl.dbi.users)