[sf-perl] Setting LD_LIBRARY_PATH

Quinn Weaver quinn at fairpath.com
Fri Jul 6 09:57:43 PDT 2007


On Thu, Jul 05, 2007 at 03:33:59PM -0700, Loo, Peter # PHX wrote:
> Hello All,
>  
> Unix admins here are not happy about updating the .profile of the
> production account to add two additional entries to LD_LIBRARY_PATH
> environment variable.  So I am having to figure out an alternative
> solution in setting this environment dynamically during program run.

Hi, Peter,

I think your Unix admins are being unreasonable--this sounds like a global
setting for all Perl programs, which is exactly the kind of thing
that should go in .profile.

However, if you can't get them to cooperate, I think David Alban has the
right tack:  write a wrapper.  If you so something like this, you can
reuse the same wrapper for multiple programs:

    #!/bin/sh

    LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/my/path
    export LD_LIBRARY_PATH
    exec $@

Call that perlwrap.  Then you can do

    /path/to/perlwrap /path/to/my_perl_program.pl [perl_prog_arguments]

For any Perl program you like.

HTH,

-- 
Quinn Weaver, independent contractor  |  President, San Francisco Perl Mongers
http://fairpath.com/quinn/resume/     |  http://sf.pm.org/
510-520-5217


More information about the SanFrancisco-pm mailing list