我应该如何安装多个版本的 Perl? [英] How should I install more than one version of Perl?

查看:41
本文介绍了我应该如何安装多个版本的 Perl?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从源代码安装 Perl 版本 5.005v5.6v5.8v5.10

现在我已经安装了v5.10.0".

<前>/opt/perl/bin/选择/perl/html/opt/perl/lib/选择/perl/人/opt/perl/lib/5.10.0/opt/perl/lib/site_perl/opt/perl/lib/site_perl/5.10.0

<小时>

如果我将它们全部安装在 /opt/perl 中,会有什么问题吗?

或者我应该将它们分成自己的、特定于版本的目录?像/opt/perl-5.10.0/

解决方案

我将所有的 perl 完全安装在它们自己的目录中,因此它们不会与任何其他 perl 共享任何内容.为此,您只需告诉 Configure 脚本在哪里安装所有内容.我喜欢/usr/local/perls:

 % ./Configure -des -Dprefix=/usr/local/perls/perl-5.x.y

当我为多个版本执行此操作时,我会得到一个具有单独安装的目录.

<前>% ls -1/usr/local/perlsperl-5.10.0perl-5.10.1perl-5.6.2perl-5.8.8

它们都有自己的 bin 和 lib 目录:

<前>% ls -1/usr/local/perls/perl-5.10.0垃圾桶库男子

如果您使用不同的 perls 调用它们,大多数常用工具都会弄清楚该怎么做:

/usr/local/perls/perl-5.10.0/bin/perl/usr/local/bin/cpan

但是,您可以将最想使用的 perl 放在您的路径中.我只是创建一个指向/usr/local/bin/perl 的符号链接,但您也可以将目录添加到 PATH.

perlbrew 为您做了很多工作,并将符号链接移动到使其中之一成为默认的 perl.我不使用它,因为它不会让我的生活更轻松.不过,这取决于您自己的决定.

I want to install, from source, Perl versions 5.005, v5.6, v5.8, v5.10

Right now I have 'v5.10.0' installed.

/opt/perl/bin
/opt/perl/html
/opt/perl/lib
/opt/perl/man
/opt/perl/lib/5.10.0
/opt/perl/lib/site_perl
/opt/perl/lib/site_perl/5.10.0


Will I have any problems if I install them all in /opt/perl?

Or should I split them up into their own, version specific, directories? Like /opt/perl-5.10.0/

解决方案

I install all of my perls completely in their own directory so they don't share anything with any other perl. To do that, you just tell the Configure script where to install everything. I like /usr/local/perls:

 % ./Configure -des -Dprefix=/usr/local/perls/perl-5.x.y

When I do that for multiple versions, I get a directory that has separate installations.

% ls -1 /usr/local/perls
perl-5.10.0
perl-5.10.1
perl-5.6.2
perl-5.8.8

They all have their own bin and lib directories:

% ls -1 /usr/local/perls/perl-5.10.0
bin
lib
man

Most of the common tools will figure out what to do if you call them with different perls:

/usr/local/perls/perl-5.10.0/bin/perl /usr/local/bin/cpan

However, you can take the perl you want to use the most and put it first in your path. I just make a symlink to /usr/local/bin/perl, but you can add directories to PATH as well.

The perlbrew does a lot of this for you and moves symlinks around to make one of them the default perl. I don't use it though because it doesn't make life easier for me. That's up to you decide on your own though.

这篇关于我应该如何安装多个版本的 Perl?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆