How can I install a separate perl without breaking an existing one?

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

+6
perl 32-bit
source share
3 answers

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

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

like the first line of your script.

For example, just a few minutes ago I did:

  $ ./configure -Dprefix = / opt / perl-5.11.0
+14
source share

You may also be interested in perlbrew by Kang-min Liu. This makes it easy to install multiple versions of perl.

After downloading and installing it, run

 perlbrew -h 

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

+3
source share

You cannot use two versions of perl for a running program for what should be reasonably obvious reasons. Not knowing why you want to do this, here are a few ideas:

  • You can compile a 32-bit perl that uses 64-bit int and floats (-Duselongdouble -Duse64bitint);
  • You can have two processes: one using your 64-bit perl, the other using 32-bit and transferring data between them using channels or shared memory.

If you need 64-bit precision, but also need to link to 32-bit libraries # 1, this can help. # 2 is obviously a more general solution, but potentially more complex and / or slower, since the communication point can be a bottleneck.

+2
source share

All Articles