如何安全地为 Perl 5.8.9 编译 Perl 5.12 模块?

发布于 2024-09-29 08:14:09 字数 960 浏览 4 评论 0原文

我想在我的 Perl 5.8.9 中安装 File::Fetch,它是 Perl 5.12 中的核心模块。一般来说,我想在回溯的 Perl 中编译和安装未来的模块,因为我无法升级我的 Perl。

所以我下载了该模块及其依赖项。遵循依赖关系树是相当痛苦的,但我更关心其中一些是核心模块的事实。如果我安装这些,我的 Perl 5.8.9 核心将包含 5.12 的补丁。

我的问题是我如何知道我是否可以安全地安装未来的模块,特别是核心模块。是否有用于测试 Perl 向后兼容性的教程?

编辑:
我的模块是双重生命的,但我无法使用 cpan 编译它。它说我的 FTPsite.yaml 有一个坏元素。但是,我遵循了模块 META 文件中的依赖关系,并且可以编译该模块。这是 cpan 的奇怪位之一吗?谢谢。

手动安装所有这些依赖项后,我无法重现该问题。但这是错误:

cpan[5]> install File::Fetch
Running install for module 'File::Fetch'
Running make for B/BI/BINGOS/File-Fetch-0.24.tar.gz
CPAN: Digest::SHA loaded ok (v5.48)
CPAN: Time::HiRes loaded ok (v1.9715)
CPAN: YAML loaded ok (v0.72)
Alert: While trying to 'parse' YAML file
 '/Users/martin/.cpan/FTPstats.yml'
with 'YAML' the following error was encountered:
  YAML Error: Invalid element in map
   Code: YAML_LOAD_ERR_BAD_MAP_ELEMENT
   Line: 3
   Document: 1
 at /opt/local/lib/perl5/site_perl/5.8.9/YAML.pm line 36

I want to install File::Fetch, which is a core module in Perl 5.12, in my Perl 5.8.9. In general, I want to compile and install future-dated modules in my back-dated Perl because I cannot upgrade my Perl.

So I downloaded the module and also its dependencies. It's quite painful following the dependency tree but I'm more concerned about the fact that some of them are core modules. If I install these, my Perl 5.8.9 core will have patches from 5.12.

My question is how I can know whether I can safely install the future-dated modules, especially the core modules. Is there a tutorial for this purpose of testing backwardcompatability in Perl?

EDIT:
My module is dual lifed, but I cannot compile it using cpan. It said my FTPsite.yaml has a bad element. However, I followed the dependencies in the modules' META files, and I could compiled the module. Is this one of the odd bits with cpan? Thank you.

I cannot recreate the issue after I installed all those dependencies manually. But here is the error:

cpan[5]> install File::Fetch
Running install for module 'File::Fetch'
Running make for B/BI/BINGOS/File-Fetch-0.24.tar.gz
CPAN: Digest::SHA loaded ok (v5.48)
CPAN: Time::HiRes loaded ok (v1.9715)
CPAN: YAML loaded ok (v0.72)
Alert: While trying to 'parse' YAML file
 '/Users/martin/.cpan/FTPstats.yml'
with 'YAML' the following error was encountered:
  YAML Error: Invalid element in map
   Code: YAML_LOAD_ERR_BAD_MAP_ELEMENT
   Line: 3
   Document: 1
 at /opt/local/lib/perl5/site_perl/5.8.9/YAML.pm line 36

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

久隐师 2024-10-06 08:14:09

如果模块可以单独使用(即“双重生命”),既可以作为独立发行版,也可以作为内部核心 Perl,那么独立版本可以安全地安装在早期 Perl 上,假设其 Makefile 允许。也就是说,如果您可以执行 cpan 并且它的构建和测试没有错误,那么您就可以了。

唯一的问题是模块是否不是双重生命的,我在 这个问题——这就是你可能会遇到的问题

If the module is available separately (i.e. "dual-lifed"), as both a standalone distribution and inside core Perl, then the standalone version is safe to install on an earlier Perl, assuming its Makefile allows it. That is, if you can do cpan <Module> and it builds and tests without errors, then you are good.

The only problem is if a module is not dual-lifed, which I opined about in this question -- which is where you are likely S.O.L.

酒与心事 2024-10-06 08:14:09

如果 perl 核心模块也可以单独使用,则意味着它可以在较旧的 perls 上工作(除非它明确需要某些版本的 perl),如果没有,那就是一个错误。

也就是说,5.10 大约在三年前发布,您将开始看到越来越多的问题,将较新的模块与旧版本的 perl 一起使用。

cpan 或 cpanplus 将为您处理依赖关系。

If a perl core module is also available separately, that means that it is intended to work on older perls (unless it explicitly requires some version of perl), and if it doesn't, that's a bug.

That said, 5.10 was released almost three years ago, and you are going to start seeing more and more problems using newer modules with older versions of perl.

cpan or cpanplus will handle dependencies for you.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文