Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
371 views
in Technique[技术] by (71.8m points)

directory - How should I install more than one version of 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/

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...