Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I install a pre-configured Perl binary package in my home directory?

I want to set up Perl 5.10 in my home directory in addition to the ancient Perl currently on the machine in the /usr/local. I am not a super-user on this machine.

I found the require 5.10 HPUX perl binary package and it seems to work, but for some reason it seems to assume it's running in /usr/local (as evidenced by @INC error messages). Is there some other variable in addition to PERLLIB, like PERLHOME or something I need to set so that Perl won't look for anything in the /usr/local dirs?

P.S. I seen advice online to compile and set the dir in the ./Configure step, but I been having hard time compiling things on this old box so I'd prefer to use the pre-compiled Perl since it seems mostly to work.


UPDATE -- Leon answered this, so basically it's not possible to run perl binary correctly from your home dir unless it was compiled with that in mind

like image 911
Ville M Avatar asked Feb 26 '09 00:02

Ville M


2 Answers

You're not going to like this answer.

Perl stores @INC as strings in its binary. Before there was userelocatableinc the technique to relocate Perl was to do a search and replace on the binary, as well as changing them in Config.pm. This is how ActiveState shipped a relocatable Perl.

The strings have to remain the same size as they were before, padding out any extra space with null bytes. ActiveState would get around this by configuring Perl with a prefix like "/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxTMPPATHxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" or something. It also made it really unambiguous to find in the binary. You don't have such luck, so it will only work if the current paths are shorter than the paths you want to replace them with.

But that's way too complicated. Just compile Perl for yourself either using HP/UX's source or just grab the regular source from perl.org. Perl has a dedicated HP/UX developer so it should all go smoothly.

like image 82
Schwern Avatar answered Nov 05 '22 22:11

Schwern


It depends on whether or not your perl binary is relocatable. It's a compile time option. What is the output of this command? Is it defined or not?

perl -V:userelocatableinc
like image 41
Leon Timmermans Avatar answered Nov 05 '22 22:11

Leon Timmermans