in reply to Re: PATH is not setting - PERL (LD_LIBRARY_PATH)
in thread PATH is not setting - PERL

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

Replies are listed 'Best First'.
Re^3: PATH is not setting - PERL (env)
by tye (Sage) on Oct 16, 2007 at 03:04 UTC

    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.
        You can get -c functionality back by prefacing your test with a check for $^C==0 (meaning "only do this if -c is NOT in effect").
        All these problems look like you never put these libraries in your cache.

        With solaris and linux, with superuser, go to the directory where your new '.so' files are and run ldconfig (with no argument). It will put them in your cache once for all.

        When you will install new versions of some libraries, you will have to do it again:
        su - superuser
        cd /usr/local/lib
        (or wherever your new files are)
        ldconfig


        That's all I needed to solve the problem.

        The others solutions discussed upper in this page are useful to load a special untested library that you do not want to be available for the regular tasks of your machine.
      Thanks tye ! excellent . it works. Regarding the error messgae : it displayed some thins in japanese , I translated it in english and posted.. Sri