Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^2: programatically setting the LD_LIBRARY_PATH

by mikeraz (Friar)
on Jan 26, 2006 at 17:10 UTC ( [id://525778]=note: print w/replies, xml ) Need Help??


in reply to (tye)Re: programatically setting the LD_LIBRARY_PATH
in thread programatically setting the LD_LIBRARY_PATH

Here's a "something close" for cases where you need multiple elements in your path.

BEGIN { my $dir; my $needed_path = 0; my @need = ( "/usr/local/lib", "/usr/platform/SUNW,Ultra-80/lib", "/usr/lib" ); my $ld_path = $ENV{LD_LIBRARY_PATH}; if( ! $ld_path ) { $ENV{LD_LIBRARY_PATH} = join ":", @need; exec 'env', $^X, $0, @ARGV; } foreach $dir (@need) { if ( $ld_path !~ m/(^|:)\Q$dir\E(:|$)/ ) { $ENV{LD_LIBRARY_PATH} .= ':' . $dir; $needed_path = 1; } } if($needed_path) { exec 'env', $^X, $0, @ARGV; } }
Be Appropriate && Follow Your Curiosity

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://525778]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (None)
    As of 2024-04-25 00:45 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found