develooper Front page | perl.dist | Postings from May 2002

Making perl location-independent.

Alan Burlison
May 14, 2002 07:47
Making perl location-independent.
Message ID:
Another thing that has always bugged me is not being able to relocate perl
without rebuilding it, even if the package that perl itself is delivered
in is relocatable.

As far as I can remember the things that would have to be fixed are:

1. Fixing up if perl is moved.
2. locating if perl is moved.
3. Fixing up @INC if perl is moved.

Are there any other issues?

#2 can be done on Solaris by specifying the location of libperl relative
to the executable, using the $ORIGIN linker magic, eg assuming perl is in
..../bin and libperl is in .../lib/sun4-solaris-64int/CORE:
   cc -o perl ... -R '$ORIGIN/../lib/sun4-solaris-64int/CORE' ...
and #3 can be done by using getexecname() and realpath() to locate where
the executable is.  However I'm not sure of how this would translate onto
other platforms.

Alan Burlison
$ head -1 /dev/bollocks
drive out-of-the-box clicks-and-mortar brand recognition Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About