What's the easiest way to install a missing Perl module?

前端 未结 24 2639
情深已故
情深已故 2020-11-21 05:28

I get this error:

Can\'t locate Foo.pm in @INC

Is there an easier way to install it than downloading, untarring, making, etc?

24条回答
  •  渐次进展
    2020-11-21 05:50

    On Unix:

    usually you start cpan in your shell:

    $ cpan

    and type

    install Chocolate::Belgian

    or in short form:

    cpan Chocolate::Belgian

    On Windows:

    If you're using ActivePerl on Windows, the PPM (Perl Package Manager) has much of the same functionality as CPAN.pm.

    Example:

    $ ppm
    ppm> search net-smtp
    ppm> install Net-SMTP-Multipart

    see How do I install Perl modules? in the CPAN FAQ

    Many distributions ship a lot of perl modules as packages.

    • Debian/Ubuntu: apt-cache search 'perl$'
    • Arch Linux: pacman -Ss '^perl-'
    • Gentoo: category dev-perl

    You should always prefer them as you benefit from automatic (security) updates and the ease of removal. This can be pretty tricky with the cpan tool itself.

    For Gentoo there's a nice tool called g-cpan which builds/installs the module from CPAN and creates a Gentoo package (ebuild) for you.

提交回复
热议问题