What does Perl do when two versions of a module are installed?

走远了吗. 提交于 2019-12-08 18:44:56

问题


I don't have root access on a remote box I'm working with, so I'm using a combination of cpanm and local::lib as described here to install CPAN modules to my local directory on the box. Using cpanm, I assume cpanm Module::To::Update would install the newest version of the module in my local library.

Apparently, I don't need root access to upgrade my modules with CPAN, as I just tried it, and the upgrade went swimmingly. However, I'm still curious which version of the module Perl will use: the local version, or the default CPAN version? Or will it just use whichever is newer?

If this exists in perldoc or Stack Overflow, I'd appreciate that as well. I tried searching both, but I wasn't able to find it =/


回答1:


It uses the first one it finds when searching though @INC in order.




回答2:


you can check it by running this in linux:

perl -e 'use <module>; print $<module>::VERSION;'



来源:https://stackoverflow.com/questions/8914322/what-does-perl-do-when-two-versions-of-a-module-are-installed

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