简体   繁体   English

如何在不安装新的Perl的情况下安装或升级最新Perl中的CPAN模块?

[英]How can I install or upgrade a CPAN module that is in the latest Perl, without installing the new Perl?

I'd like to install a Perl module (in this case, FindBin ), but since it is included in the Perl 5.10.1 distribution , cpan wants to install Perl 5.10 for me. 我想安装一个Perl模块(在本例中为FindBin ),但是由于它包含在Perl 5.10.1发行版中 ,因此cpan希望为我安装Perl 5.10。 Is there a way of installing just the module via cpan ? 有没有一种方法可以通过cpan安装模块?

The only option that I can see is installing directly from source , which seems a bit crude as there is no separate package (for example, Makefile.PL , etc.), just the bare .pm file. 我能看到的唯一选择是直接从源代码安装 ,由于没有单独的软件包(例如Makefile.PL等),仅裸露的.pm文件,这似乎有点粗糙。

Since this is a small module that only has the one file, it's doable in this case, but what if I wanted to install a much larger package? 由于这是一个只有一个文件的小模块,因此在这种情况下是可行的,但是如果我想安装更大的软件包怎么办?

EDIT: This is somewhat aside from the original question, but speaks to the general issue of modules being packaged up with Perl distributions: I discovered that the "standalone" FindBin ( version 1.49 ) had a syntactic error, so I retrieved version 1.50 out of the Perl 5.10.1 distribution... However since the module is now listed on CPAN as part of Perl 5.10, I am unable to find the CHANGES file describing what was changed/fixed in this delta. 编辑:这与原始问题有所不同,但是谈到了与Perl发行版打包在一起的模块的一般问题:我发现“独立” FindBin( 1.49版 )存在语法错误,因此我从中检索到1.50版 Perl 5.10.1发行版...但是,由于该模块现在作为Perl 5.10的一部分列在CPAN上,所以我找不到描述此delta中已更改/修复的内容的CHANGES文件。 Is it reasonable that I should have to go into the developer repository to pull out this information?) 我必须进入开发人员资料库以提取此信息是否合理?)


EDIT 2. Okay, here's a better example . 编辑2.好的,这是一个更好的示例 On Perl 5.8.8 I have version 1.04 of Carp. 在Perl 5.8.8上,我具有1.04版的Carp。 However, I see that Perl 5.10.1 comes packaged with version 1.11. 但是,我看到Perl 5.10.1随版本1.11打包在一起。 Is there a way of getting CPAN to install the latest version of Carp for me without dragging in all of Perl 5.10.1? 有没有一种方法可以让CPAN为我安装最新版本的Carp,而不用拖累所有Perl 5.10.1? I can't even find a link to the Carp module on CPAN except to the perl 5.10.1 installation . 除了Perl 5.10.1的安装,我什至找不到CPAN上Carp模块的链接。

> corelist FindBin

FindBin was first released with perl 5.00307

Which version of Perl do you use that does not include FindBin? 您使用的哪个Perl版本不包含FindBin? If you use at least Perl 5.6.0 (all versions before are considered deprecated), you have no need to install FindBin. 如果您至少使用Perl 5.6.0(不推荐使用之前的所有版本),则无需安装FindBin。 If you have anything older, I suggest an upgrade to 5.6.2/5.8.9/5.10.1. 如果您有任何较旧的版本,建议升级到5.6.2 / 5.8.9 / 5.10.1。

Kurila is not a "standalone" FindBin, it's a dialect of Perl. Kurila不是“独立”的FindBin,而是Perl的方言。 FindBin is not a dual life and is released only bundled with Perl. FindBin不是双重生活,只能与Perl捆绑发行。 You can consider releasing FindBin to CPAN as standalone distribution - it is easy if you used ExtUtils::MakeMaker in past. 您可以考虑将FindBin作为独立发行版发布到CPAN-如果您以前使用过ExtUtils :: MakeMaker,这很容易。

Latest useful change of FindBin was on 2007-04-28, related to VMS. FindBin的最新有用更改是在2007-04-28,与VMS有关。 Latest useful non-VMS change was on 2006-10-25. 最新的有用的非VMS更改是在2006-10-25。

Things you can try include 您可以尝试的事情包括

  • Dropping FindBin.pm into the same directory as your executable and using use FindBin 将FindBin.pm放到与可执行文件相同的目录中,并使用use FindBin
  • Dropping FindBin.pm into your Perl library directory 将FindBin.pm放到Perl库目录中
  • Using the source code of the module in your script 在脚本中使用模块的源代码

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM