[sf-perl] Setting LD_LIBRARY_PATH

Loo, Peter # PHX Peter.Loo at source.wolterskluwer.com
Fri Jul 6 10:15:18 PDT 2007


Thanks everyone for your inputs. 

My director has convinced the admins to add to the .profile.  I thought
of the idea of having a shell wrapper setting the environment before
spawning off the Perl program, however, the Perl program itself is a
wrapper that performs many different tasks according to a list of
parameters that I dynamically pass to it.  At any rate, the issue is
resolved with the entries into the .profile.

I do have one question though.  If I was to have a Perl program that
sets $ENV{LD_LIBRARY_PATH} = 'some value'; then spawning of another Perl
program from within it using system(), will the spawned Perl program
inherit the set environment variable?

Thanks.
 
Peter

-----Original Message-----
From: sanfrancisco-pm-bounces+peter.loo=source.wolterskluwer.com at pm.org
[mailto:sanfrancisco-pm-bounces+peter.loo=source.wolterskluwer.com at pm.or
g] On Behalf Of Quinn Weaver
Sent: Friday, July 06, 2007 9:58 AM
To: San Francisco Perl Mongers User Group
Subject: Re: [sf-perl] Setting LD_LIBRARY_PATH

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
_______________________________________________
SanFrancisco-pm mailing list
SanFrancisco-pm at pm.org
http://mail.pm.org/mailman/listinfo/sanfrancisco-pm


This E-mail message is for the sole use of the intended recipient(s) and
may contain confidential and privileged information.  Any unauthorized
review, use, disclosure or distribution is prohibited.  If you are not
the intended recipient, please contact the sender by reply E-mail, and
destroy all copies of the original message.


More information about the SanFrancisco-pm mailing list