kprasanna_79 has asked for the wisdom of the Perl Monks concerning the following question:

Greetings Monk,

My current project was with unix (hpunix)environment, where i have two versions of perl (5.6.1 & 5.00_03). When i install new modules say DBI or DBD::Oracle where will it go and install..i mean to say to which of its library path will it get installed..

I still know that we can give the path while installing the modules..but on eager i am asking this question

This question is little bit on perl in unix environment. When i install a new version of perl in unix machine, wont the new library path will be added to the old path which is for the old version of perl.

In my project if i add shebang line as one new version perl path, its taking that libraries and if add another version perl path its taking its own libraries. So i am little bit unclear here..wont the library path be added up when i install new versions of perl...

Please excuse for typos and grammer

-prasanna.K

Replies are listed 'Best First'.
Re: Two versions of perl in same machine
by chanakya (Friar) on Jul 14, 2005 at 07:39 UTC
    You can have multiple Perl versions on the Unix box, without any problems. I have 4 Perl versions out of which 3 are compiled.
    When you install new Perl, the paths from old Perl won't be automatically added to the new Perl path, you should add these paths during installation.

    Before installing the new perl make a list of paths which you want to add to new Perl search path
    perl -le 'print foreach(@INC)'
    During the installation put the paths as listed below
    List of earlier versions to include in @INC? [none] /usr/local/lib/per +l/5.6.1 /usr/local/share/perl/5.6.1 /usr/lib/perl5 /usr/share/perl5 / +usr/lib/perl/5.6.1 /usr/share/perl/5.6.1 /usr/local/lib/site_perl
    Once the shiny Perl is installed check out the paths, but I should note one problem here, you should install DBI modules for the new Perl, beacuse the .so files will be compiled with that Perl version, so the old DBI compiled modules are not compatible with new Perl.

    Hope this helps
Re: Two versions of perl in same machine
by rinceWind (Monsignor) on Jul 14, 2005 at 07:01 UTC

    This shouldn't be a problem. I am regularly working on machines that have more than one perl, and frequently where I don't have root. Which perl binary you get is dependent on the order of directories in $ENV{PATH}, so if you want the new perl, make sure it goes in PATH first.

    The suplementary libraries that are part of perl are specific to your perl binary. If your perl is in /home/foo/perl5/bin, these will be in /home/foo/perl5/lib/... Note that these are set up at perl's build time and saved in Config.pm (usable by scripts that need to check that sort of thing). All installed modules are specific to the perl you are using. The other perl will have a different directory tree with a different set of modules. The same is true of extensions (XS modules); they live under the perl lib directory in an architecture specific directory.

    When it comes to libraries for external code, these are searched for in $ENV{LD_LIBRARY_PATH}, which won't change if you switch which perl executable you are using.

    Hope this helps

    --

    Oh Lord, won’t you burn me a Knoppix CD ?
    My friends all rate Windows, I must disagree.
    Your powers of persuasion will set them all free,
    So oh Lord, won’t you burn me a Knoppix CD ?
    (Missquoting Janis Joplin)

Re: Two versions of perl in same machine
by castaway (Parson) on Jul 14, 2005 at 09:27 UTC
    Each perl uses its own set of builtin library paths, plus whatever is in the PERL5LIB environment variable, and whatever you give in "use lib" in your script. To find out which library paths a Perl thinks it is using, type:
    /path/to/perl -V
    for each of the perls you have.

    C.