Discussion:
How to set LD_LIBRARY_PATH in perl script
(too old to reply)
James
2007-05-15 19:37:51 UTC
Permalink
Instead of exporting LD_LIBRARY_PATH from command-line,
is there a way to do this inside the perl script?

LD_LIBRARY_PATH=/usr/local/ssl/lib perl-script
works, but I want the scriipt takes care of this inside.

TIA
James
Stachu 'Dozzie' K.
2007-05-15 20:04:27 UTC
Permalink
Post by James
Instead of exporting LD_LIBRARY_PATH from command-line,
is there a way to do this inside the perl script?
LD_LIBRARY_PATH=/usr/local/ssl/lib perl-script
works, but I want the scriipt takes care of this inside.
LD_LIBRARY_PATH is taken into an account mainly when ELF binary (here:
Perl interpreter) is executed (and later when it dlopen()s an ELF
object), so you should set it before script is executed at all.

Actually, you could try to re-execute script if appropriate path isn't
present in LD_LIBRARY_PATH variable.
--
Secunia non olet.
Stanislaw Klekot
Barry Margolin
2007-05-16 05:04:27 UTC
Permalink
Post by James
Instead of exporting LD_LIBRARY_PATH from command-line,
is there a way to do this inside the perl script?
LD_LIBRARY_PATH=/usr/local/ssl/lib perl-script
works, but I want the scriipt takes care of this inside.
$ENV{LD_LIBRARY_PATH}="/usr/local/ssl/lib";

Note that this will only affect external programs run by the script, it
won't link perl itself with the libraries in that directory.
--
Barry Margolin, ***@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
Continue reading on narkive:
Loading...