如何在使用perlbrew时安装CPAN模块?

时间:2023-01-12 19:48:19

I have started using perlbrew and installed perl-5.12.2.

我已经开始使用perlbrew并安装了perl-5.12.2。

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).

我知道我需要重新安装我的CPAN模块,所以我切换到我的新Perl版本(perlbrew开关perl-5.12.2和hash -r),验证交换机是否成功(perl -v)然后尝试安装一些模块( File :: Copy ::使用cpan递归。但是,cpan说`File :: Copy :: Recursive是最新的(0.38)。

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.

当我使用这个模块启动一个Perl脚本时,它会在@INC中找不到File / Copy / Recursive.pm ...(显示许多perl-5.12.2位置)。当我切换回我的'普通'Perl(perlbrew off)时,脚本运行正常。

Any suggestions? Perhaps CPAN does not work well with perlbrew?

有什么建议么?也许CPAN与perlbrew不兼容?

2 个解决方案

#1


31  

After installing perlbrew you could install cpanm through this command:

安装perlbrew后,您可以通过以下命令安装cpanm:

perlbrew install-cpanm

Otherwise you will need to install cpanm manually each time you switch your Perl version on perlbrew. With this command just once.

否则,每次在perlbrew上切换Perl版本时,都需要手动安装cpanm。使用此命令只需一次。

#2


1  

Everything should be working fine with "cpan" as well as "cpanm", that is: when switching perl with perlbrew, cpan sees the installed modules of the version you use.

一切都应该与“cpan”以及“cpanm”一起正常工作,即:当用perlbrew切换perl时,cpan会看到你使用的版本的已安装模块。

While it's true that cpanm is the recommended tool to use with perlbrew, cpan allows for test reporting so that is what I always use.

虽然cpanm是与perlbrew一起使用的推荐工具,但cpan允许进行测试报告,这是我一直使用的。

#1


31  

After installing perlbrew you could install cpanm through this command:

安装perlbrew后,您可以通过以下命令安装cpanm:

perlbrew install-cpanm

Otherwise you will need to install cpanm manually each time you switch your Perl version on perlbrew. With this command just once.

否则,每次在perlbrew上切换Perl版本时,都需要手动安装cpanm。使用此命令只需一次。

#2


1  

Everything should be working fine with "cpan" as well as "cpanm", that is: when switching perl with perlbrew, cpan sees the installed modules of the version you use.

一切都应该与“cpan”以及“cpanm”一起正常工作,即:当用perlbrew切换perl时,cpan会看到你使用的版本的已安装模块。

While it's true that cpanm is the recommended tool to use with perlbrew, cpan allows for test reporting so that is what I always use.

虽然cpanm是与perlbrew一起使用的推荐工具,但cpan允许进行测试报告,这是我一直使用的。