perlmodulecpan

How can I tell cpan to change the target for the module installation?


When I installed perl from the source the first nice surprise was that without doing something all module installed from now on were available to the new perl. Since I didn't find one module on cpan that comes with my OS I have to use for some scripts the onboard-perl. For one of these scripts I would like to install Text::Format or Text::Autoformat (didn't find the docu for that module on cpan). My question: how can I tell cpan to install the module this one time for the OS-distro-perl?


Solution

  • Each Perl installation has its own idea of where libraries should "live", which the CPAN module uses as a guide for where to perform its installations. You can see what these values are by executing perl -V, and look for the value of @INC (at the bottom). If you invoke CPAN with a different Perl (e.g. your system-installed Perl), you will automatically install modules into that Perl's preferred location:

    /usr/bin/perl -MCPAN -e shell
    

    or to simply install one module without having to invoke the CPAN shell explicitly:

    /usr/bin/cpan <modulename>
    

    There are also CPAN configuration options available where you can temporarily or permanently change the install location, but this should not be necessary in your case.