aartist
aartist

Reputation: 3236

How can I install a separate perl without disturbing the existing one?

How I should install 32-bit Perl on 64-bit machine without affecting the existing applications that uses 64-bit Perl? Is it possible to have a single application (Read: Single file) use different version of Perl for different tasks?

Upvotes: 6

Views: 2892

Answers (3)

Christopher Bottoms
Christopher Bottoms

Reputation: 11158

You might also be interested in perlbrew by Kang-min Liu. It allows you to easily install multiple versions of perl.

After downloading it and installing it, run

perlbrew -h

to see the options. Looking at the documentation, it seems to be able to use the -D options as Sinan and Mark mentioned.

Upvotes: 3

Mark
Mark

Reputation: 1304

You can't use two versions of perl for a running program for what should be fairly obvious reasons. Without knowing why you want to do that, here are a few ideas:

  1. You can compile a 32 bit perl that uses 64 bit ints and floats (-Duselongdouble -Duse64bitint);
  2. You could have two processes, one using your 64 bit perl the other using 32 bit and pass data between them using pipes or shared memory.

If you need 64 bit precision but also need to link with 32 bit libraries #1 might help. #2 is obviously a more general solution but potentially harder and/or slower since the communication point could be a bottleneck.

Upvotes: 2

Sinan Ünür
Sinan Ünür

Reputation: 118128

Install the custom perl in a different directory, say /opt/perl-5.10.1-32bit and specify that path in the scripts which you want to use this custom version:

#!/opt/perl-5.10.1-32bit/perl

as the first line of your script.

For example, just a few minutes ago, I did:

$ ./configure -Dprefix=/opt/perl-5.11.0

Upvotes: 14

Related Questions