FAQ 8.45 How do I install a module from CPAN?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

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.

                perl Makefile.PL


                make test

                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


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

Site Timeline