in reply to PATH is not setting - PERL

Setting LD_LIBRARY_PATH after the perl executable is already running likely doesn't do any good on many systems. The "dynamic linker/loader" component has already read and cached a copy of the LD_LIBRARY_PATH value and so doesn't notice your change. A search for LD_LIBRARY_PATH will turn up many discussions of this point and possible work-arounds, such as those included in the DBI, DBD::Oracle and LD_LIBRARY_PATH thread.

- tye        

  • Comment on Re: PATH is not setting - PERL (LD_LIBRARY_PATH)

Replies are listed 'Best First'.
Re^2: PATH is not setting - PERL (LD_LIBRARY_PATH)
by srini_sun (Initiate) on Oct 16, 2007 at 02:22 UTC
    Thanks Tye,
    I added the same lines but I am getting the below error "env:this is not a file or a directory" BEGIN { unless ($ENV{BEGIN_BLOCK}) { $ENV{ORACLE_HOME} = '/opt/instantclient_10_2/'; $ENV{LD_LIBRARY_PATH} = '/opt/instantclient_10_2/'; #$ENV{TNS_ADMIN} = '/common/oracle/env'; $ENV{BEGIN_BLOCK} = 1; exec 'env',$0,@ARGV; } }
    Thanks Sri

      You can replace 'env' with $^X and hope your dynamic loader doesn't notice that the perl executable is exec'ing the perl executable, like happens on some systems.

      There are also lots of less 'tricky' ways that don't have this problem. For example, have a shell script (or ".bat" file) wrapper that calls your Perl script.

      "env:this is not a file or a directory"

      Oh, I just realized that this is probably not a copy'n'paste of the actual error message but more likely a bad hand copy job and the real error is closer to:

      env: yourscript: No such file or directory

      which means that exec 'env', $^X, $0, @ARGV; will likely work.

      - tye        

        The one downside of this exec hack is you can no longer check syntax or debug, since 'perl -c myprog.pl' will execute the BEGIN block at compile time.
        Thanks tye ! excellent . it works. Regarding the error messgae : it displayed some thins in japanese , I translated it in english and posted.. Sri