How do I install CPAN modules while using perlbrew?

狂风中的少年 提交于 2019-11-28 16:26:30

问题


I have started using perlbrew and installed 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).

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.

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


回答1:


After installing perlbrew you could install cpanm through this command:

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.




回答2:


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.

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.



来源:https://stackoverflow.com/questions/3733482/how-do-i-install-cpan-modules-while-using-perlbrew

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!