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

Hello , What I would like to do, is create a "duplicate" perl instance from the OS installed system perl . This would be 5.8.8. This is in relation to an early post I had made (#1135687). My perl users have been using the OS install and I now want to move them off of it to their own. So that my OS upgrades do not effect their current perl. I can easily copy/create a new directory structure for them ( /usr/opt/perl5/* -> /segregated). But not sure how best to alter the @INC declaration or any other pieces that may need pointed to this area. In looking at perlbrew, I'm not quite sure if this will do it (not installing different, but replicated). Nor do I know/think autobundle is what I need , or if autobundle is overkill. I know that future module adds would require me to add Prefix= to the "perl Makefile.PL " step.Would appreciate any wisdom/suggestions you may have on this. Thanks very much in advance.

Replies are listed 'Best First'.
Re: Replicating perl instance on AIX 6.1
by Corion (Patriarch) on Aug 28, 2015 at 19:17 UTC

    I would approach the problem by inspecting the output of perl -V:userelocatableinc. If that is defined, you can simply copy perl and all files to a different directory and everything will use the paths from the new directory. You might need to edit lib/Config.pm and lib/CPAN/Config.pm to point to the new directories too.

    If the Perl was not compiled with a relocatable @INC, then you will need to adjust the module search path for Perl. The easiest way is to set PERL5LIB to the wanted new paths. To be really certain that the new copy of Perl does not use old paths, you should patch the new Perl executable to remove all references to the old path. Ideally, you replace the path by something with exactly the same length, for example by using:

    perl -nle 's!/usr/share/perl5!/usr/share/____5!g' /path/to/new/perl
      Corion, userelocatableinc came back "Unknown" when I issued the command you suggested; perl -V:userelocatableinc. so, would I then pursue your second suggestion of using PERL5LIB along with patching perl executable? Thank you

        Yes, that sounds like a plan. Also see the comments made by others in this thread.

Re: Replicating perl instance on AIX 6.1
by flexvault (Monsignor) on Aug 28, 2015 at 21:26 UTC

    Welcome twieckow,

    On all my AIX systems ( 5.2 to 7.1 ), Perl is very easy to install and would recommend you not use the system Perl except for your Admin work. However, I also recommend you use 'gcc' and not the native 'xlc' compiler, since I found it much easier to get a clean Perl version using 'gcc'.

    New versions of Perl are excellent and you can use '/usr/local/bin' to link the version for your users:

    ln -s /usr/opt/perl5.14.4/bin/perl /usr/local/bin/myperl

    Obviously the version of Perl you use and the name you call it is dynamic.

    I did use 'perl5.14.4' because it works very well on AIX 6.1. If you don't need 'threads', I would recommend configuring Perl without 'threads'. If you have a need, I usually build 2 versions, one with (myperl-t) and one without(myperl).

    On AIX, I see additional overhead with the 'threads' version even if your not using 'threads'.

    Good Luck!

    Regards...Ed

    "Well done is better than well said." - Benjamin Franklin

Re: Replicating perl instance on AIX 6.1
by syphilis (Archbishop) on Aug 29, 2015 at 03:05 UTC
    What I would like to do, is create a "duplicate" perl instance from the OS installed system perl

    Could you give us the output of:
    perl -V:config_args
    Cheers,
    Rob
      Hello Rob. here is the output of perl-V:config_args :/# :/# perl -V:config_args config_args='-desr -Dinstallprefix=/usr/opt/perl5 -Dprefix=/usr/opt/perl5 -Dcc=x lc_r -Duseshrplib -Dusethreads'; :/#
        here is the output of perl-V:config_args

        I take it that's the "duplicate" of the system perl.
        I was actually wondering more about the config_args for the system perl - but if you're striking no issues with the duplicate you've created then there's no need for any additional action or information.

        In any case, I probably have little to offer as I've never run AIX !!

        I was a little curious as to why you felt you needed a "duplicate" of the system perl.
        Usually people look for pretty much *any* perl (generally a recent version) as a replacement - the important thing being that they can avoid messing with the system perl.
        But, it's not important that I have an understanding of the need for a duplicate, anyway.

        Cheers,
        Rob
Re: Replicating perl instance on AIX 6.1
by twieckow (Novice) on Aug 31, 2015 at 13:52 UTC
    Thank you all for the help!! It is much appreciated.