CPAN在哪里安装模块? [英] Where does CPAN install modules?

查看:69
本文介绍了CPAN在哪里安装模块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我找不到有关CPAN文件安装位置的权威/全面描述。我认为必须有一套规则,而且它不如 XYZ目录那么简单,因为,例如,即使安装了一个Perl,Linux盒子上的多个用户也可以运行CPAN,但它仍然可以正常工作。那么,这些规则是什么?

I can't find an authoritative/comprehensive description of where CPAN installs its files. I assume there must be a set of rules and that it's not as simple as "XYZ directory" because, for example, multiple users on a Linux box can run CPAN even though there's a single Perl installation and it still somehow works. So, what are those rules?

这个问题的第二部分:PERL5LIB环境变量的文档说它是要在其中查找目录的列表在查看标准库和当前目录之前,先查看Perl库文件。

A second part of this question: The documentation for the PERL5LIB environment variable says that it is "A list of directories in which to look for Perl library files before looking in the standard library and the current directory."

我认为CPAN不会安装到标准库位置,因为大概是针对特定的Perl版本固定的。那么也许CPAN可以安装到PERL5LIB中吗?

I assume that CPAN doesn't install into the standard library location, since presumably that is fixed for a particular Perl version. So maybe CPAN installs into PERL5LIB?

最后,正如我已经提到的那样,CPAN如何处理多个用户可能正在运行同一Perl安装的事实?抱歉,如果这是一个单独的问题,但可能与它有关。

And finally, as I already alluded to, how does CPAN handle the fact that multiple users might be running the same Perl installation? Sorry if that's a separate question but it seems probably related.

推荐答案

Perl指定了三套安装位置。

Perl specifies three sets of installation locations.


  • perl ,用于Perl本身包含的模块。

  • 供应商,用于由 perl 二进制文件的提供者安装的模块。

  • 站点,用于使用 cpan 安装的模块。

  • perl, for modules included with Perl itself.
  • vendor, for modules installed by the provider of your perl binary.
  • site, for modules installed using cpan.

每个这些集合提供了许多文件类型的安装位置。

Each of these sets provides installation locations for a number of files types.

                        Installation location
                        --------------------------------------------------------
Type of file            perl             vendor                 site
----------------------  ---------------  ---------------------  -------------------
Build-specific modules  installarchlib   installvendorarch      installsitearch
Modules                 installprivlib   installvendorlib       installsitelib
Binary programs         installbin       installvendorbin       installsitebin
Other programs          installscript    installvendorscript    installsitescript
man pages for scripts   installman1dir   installvendorman1dir   installsiteman1dir
man pages for modules   installman3dir   installvendorman3dir   installsiteman3dir
html docs for scripts   installhtml1dir  installvendorhtml1dir  installsitehtml1dir
html docs for modules   installhtml3dir  installvendorhtml3dir  installsitehtml3dir

您可以获取以下任何位置的路径使用以下命令:

You can obtain the path for any of these locations using the following:

perl -V:{var}        # Substitute `{var}` for the var name.

您可以使用以下命令获取这些位置的所有路径:

You can obtain all the paths for these locations using the following:

perl -V:'install.*'

这些是安装程序的默认设置 [1] 。但是,两个最常用的安装程序使用户进行安装时可以覆盖所有这些。如果模块安装在非标准位置,则可以使用 PERL5LIB 告知 perl 在哪里

Those are the defaults use by the installers[1]. However, the two most commonly used installers allow the user doing to installation to override any and all of these. If a module is installed in a non-standard location, PERL5LIB can be used to let perl know where to find the module.


  1. CPAN不安装模块。这是一个存储库。

  1. CPAN doesn't install modules. It's a repository.

cpan 不会安装模块。从CPAN下载 cpan 发行版并运行其中提供的安装程序,无论是 Makefile.PL 还是 Build.PL 。 ( cpanm cpanp 同样。)

cpan doesn't install modules. cpan download distributions from CPAN and runs the installer provided within, be it Makefile.PL or Build.PL. (Same goes for cpanm and cpanp.)

这些脚本大多使用 ExtUtils :: MakeMaker Module :: Build 安装发行版(尽管存在其他安装程序)。

These scripts mostly use ExtUtils::MakeMaker or Module::Build install the distribution (though other installers exist).

这篇关于CPAN在哪里安装模块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆