+ Reply to Thread
Results 1 to 3 of 3

How to set LD_LIBRARY_PATH in perl script

  1. How to set LD_LIBRARY_PATH in perl script

    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


  2. Re: How to set LD_LIBRARY_PATH in perl script

    On 15.05.2007, James wrote:
    > 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

  3. Re: How to set LD_LIBRARY_PATH in perl script

    In article <1179257871.681401.67500@p77g2000hsh.googlegroups.com>,
    James wrote:

    > 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, barmar@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 ***

+ Reply to Thread