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

前端 未结 24 2741
情深已故
情深已故 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:41

    Otto made a good suggestion. This works for Debian too, as well as any other Debian derivative. The missing piece is what to do when apt-cache search doesn't find something.

    $ sudo apt-get install dh-make-perl build-essential apt-file
    $ sudo apt-file update
    

    Then whenever you have a random module you wish to install:

    $ cd ~/some/path
    $ dh-make-perl --build --cpan Some::Random::Module
    $ sudo dpkg -i libsome-random-module-perl-0.01-1_i386.deb
    

    This will give you a deb package that you can install to get Some::Random::Module. One of the big benefits here is man pages and sample scripts in addition to the module itself will be placed in your distro's location of choice. If the distro ever comes out with an official package for a newer version of Some::Random::Module, it will automatically be installed when you apt-get upgrade.

提交回复
热议问题