gpt4 book ai didi

perl 依赖管理 extUtils::Installed list into a container

转载 作者:行者123 更新时间:2023-12-04 07:24:48 24 4
gpt4 key购买 nike

在 Python 中我们有 pip install -r requirements.txt。 perl 中有类似的东西吗?

我怎样才能从这个 ExtUtils::Installed 列表开始并首先安装给定的 perl,然后安装正确的版本模块?

./installed.pl 
DBD::SQLite - 1.66
DBI - 1.643
Perl - 5.26.1

Extutils 适用于目录路径和 .packlists

最佳答案

听起来像 cpanfilecpanm很适合这里。

你的容器应该首先安装正确的 perl(比如 perlbrew ),然后是 App::cpanminus .之后,一个名为 cpanfile 的文件对应于上面的 requirements.txt 或 .packlist,看起来像

requires 'DBI' => '1.643';
requires 'DBD::SQLite' => '1.66';

您使用 cpanm --installdeps 进行安装。 将安装其余部分。

该文件格式指定了这些模块的最低版本,即隐式 >=。如果您需要固定特定版本,请使用 == 或避免使用带有 != 的版本。

cpanfile 格式很灵活,允许您使用 --with-develop 标志等有条件地安装模块

编辑:有些人更喜欢 cpm 的速度通过 cpanm 安装大量模块。它采用一些快捷方式(默认情况下跳过测试),这些快捷方式在稳定的环境中不会产生影响。

关于perl 依赖管理 extUtils::Installed list into a container,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68272447/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com