问题描述
我已经开始使用 perlbrew
并安装了 perl-5.12.2.
I have started using perlbrew
and installed perl-5.12.2.
我知道我需要重新安装我的 CPAN 模块,所以我切换到我的新 Perl 版本(perlbrew switch perl-5.12.2
和 hash -r
), 验证切换成功 (perl -v
) 然后尝试安装一些模块 (File::Copy::Recursive
使用 cpan
.然而,cpan
说`File::Copy::Recursive 是最新的(0.38).
I understand I need to re-install my CPAN modules, so I switched to my new Perl version (perlbrew switch perl-5.12.2
and hash -r
), verified the switch was successful (perl -v
) then tried installing some module (File::Copy::Recursive
using cpan
. However, cpan
says `File::Copy::Recursive is up to date (0.38).
当我使用这个模块启动一个 Perl 脚本时,它大喊 Can't locate File/Copy/Recursive.pm in @INC ...
(显示许多 perl-5.12.2
位置).当我切换回我的正常"Perl(perlbrew off
)时,脚本运行良好.
When I start a Perl script using this module, it shouts Can't locate File/Copy/Recursive.pm in @INC ...
(showing many perl-5.12.2
locations). When I switch back to my 'normal' Perl (perlbrew off
) the script runs fine.
有什么建议吗?也许 CPAN 不能很好地与 perlbrew
配合使用?
Any suggestions? Perhaps CPAN does not work well with perlbrew
?
推荐答案
安装 perlbrew 后,您可以通过以下命令安装 cpanm:
After installing perlbrew you could install cpanm through this command:
perlbrew install-cpanm
否则,每次在 perlbrew 上切换 Perl 版本时,您都需要手动安装 cpanm.只需使用此命令一次.
Otherwise you will need to install cpanm manually each time you switch your Perl version on perlbrew. With this command just once.
安装后,您可以使用 cpanm
安装缺少的模块:
Once installed you can then use cpanm
to install the missing module:
cpanm File::Copy::Recursive
这篇关于使用 perlbrew 时如何安装 CPAN 模块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!