如何在Windows和Strawberry Perl上安装具有脱机依赖关系的Perl模块?

时间:2014-09-16 07:19:05

标签: perl installation offline strawberry-perl cpanm

我需要在没有访问互联网的Windows机器上安装Strawberry Perl和许多Perl模块(带有依赖项)(出于安全原因)。

Strawberry Perl的离线安装工作正常,但我无法安装我需要的其他模块。

我使用Pinto

在Ubuntu机器上准备了类似CPAN的存储库
pinto --root my_repo init
pinto --root my_repo pull -M Some::Mudule1 Some::Mudule2

然后我将my_repo目录作为C:\some\path\my_repo转移到目标计算机并尝试:

cpanm --mirror "file://C:/some/path/my_repo" --mirror-only Some::Mudule1 Some::Mudule2

但最终出现了错误消息:

! cannot open file 'C:\Users\dedek/.cpanm/sources/file%C%some%path%my_repo/02packages.details.txt.gz': No such file or directory opening compressed index
! Couldn't find module or a distribution Some::Mudule1
! cannot open file 'C:\Users\dedek/.cpanm/sources/file%C%some%path%my_repo/02packages.details.txt.gz': No such file or directory opening compressed index
! Couldn't find module or a distribution Some::Mudule2

为什么cpanm寻找这样奇怪的位置?我该如何解决?有没有更简单的方法如何离线安装Perl模块?如果我可以在Windows机器上准备CPAN之类的存储库也会很好。但是我没有成功在Windows上安装Pinto,有可能吗?

1 个答案:

答案 0 :(得分:1)

最后我发现了自己的错误。原文中有一个符号链接modules -> stacks/master/modules CPAN就像Pinto制作的存储库一样。这个链接在传输过程中被丢弃(使用WinSP)。当我将my_repo/stacks/master/modules复制到my_repo/modules时,一切正常。

我非常感谢来自cpanm的更相关的错误消息!