如何告诉cpan更改模块安装的目标? [英] How can I tell cpan to change the target for the module installation?
问题描述
当我从源代码安装perl时,第一个不错的惊喜是,如果不执行任何操作,则从现在开始安装的所有模块都可用于新的perl.由于我没有在操作系统随附的cpan上找到一个模块,因此必须将某些脚本用于onboard-perl.对于这些脚本之一,我想安装Text :: Format或Text :: Autoformat(在cpan上找不到该模块的文档).我的问题:我该如何告诉cpan这次为OS-distro-perl安装模块?
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?
推荐答案
每个Perl安装都有自己的想法,库应该驻留"在哪里,CPAN模块将其用作在哪里执行安装的指南.您可以通过执行perl -V
来查看这些值是什么,并寻找@INC
的值(在底部).如果您使用其他Perl(例如,系统安装的Perl)调用CPAN,则会自动将模块安装到该Perl的首选位置:
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
或者只安装一个模块而不必显式调用CPAN shell:
or to simply install one module without having to invoke the CPAN shell explicitly:
/usr/bin/cpan <modulename>
还有一些CPAN配置选项,您可以在其中临时或永久更改安装位置,但是在您的情况下,这不是必需的.
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.
这篇关于如何告诉cpan更改模块安装的目标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!