如何将外部管理的 Perl 安装添加到 Perlbrew?
我想使用 perlbrew 来管理我系统上的多个 Perl 安装。
然而,除了从 CPAN 进行的全新安装和系统安装之外,我还有一些与特定项目相关的其他 Perl 安装。我也希望能够切换
到这些 perls。
例如,如果我有 /opt/SomeApp/perl/bin/perl
以及 /opt/SomeApp/perl/lib
中的库,如何将其添加到 perlbrew?
I would like to use perlbrew to manage multiple Perl installations on my system.
However, in addition to the clean installs from CPAN and the system install, I have a couple of other Perl installs that are tied to specific projects. I would like to be able to switch
to these perls as well.
For example, if I have /opt/SomeApp/perl/bin/perl
with libraries in /opt/SomeApp/perl/lib
, how do I add it to perlbrew?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Perlbrew
确实允许您切换到任何可以使用的 Perl在PATH环境变量中查找。例如:您现在应该看到
/opt/SomeApp/perl/bin/perl
列为perlbrew
管理的 perl。所以现在(在同一个 shell 会话中)你可以这样做:注意。您可能会发现
perlbrew switch ...
无需修改 $PATH 即可工作。/I3az/
Perlbrew
does allow you to switch to any Perl it can find in the PATH environment variable. For eg:You should now see
/opt/SomeApp/perl/bin/perl
listed as a perl thatperlbrew
manages. So now (in the same shell session) you could do:NB. You will probably find that the
perlbrew switch ...
works without having to amend $PATH./I3az/
perlbrew 在 PERLBREW 环境变量下查找它的 perls,但它也期望在那里找到的不仅仅是你的 perls。它还管理一些状态并创建一些目录来保存最新的符号链接。
当您在 perlbrew 目录中创建符号链接使其看起来像 /opt/SomeApp/perl/bin/perl 是 ~/perl5/perlbrew/perl/SomeApp 时,会发生什么?
不过,我仍然认为这会导致混乱和灾难。任何需要特定安装的东西都不应该依赖于可变链接。
perlbrew looks for its perls under the PERLBREW environment variable, but it's also expecting to find more than just your perls under there. It's also managing some state and creating some directories to hold the latest symlinks.
What happens when you make symlinks in your perlbrew directory so it looks like /opt/SomeApp/perl/bin/perl is ~/perl5/perlbrew/perl/SomeApp?
I still think this is a recipe for confusion and disaster, though. Anything that needs a specific installation shouldn't rely on a mutable link.