in reply to Re^2: Env Variables
in thread Env Variables

Before trying other things I would try something like:

#!/usr/bin/perl BEGIN { unless ($ENV{DONE_RESTARTING_MYSELF}) { # avoid endless loop... $ENV{DONE_RESTARTING_MYSELF} = 1; $ENV{ORACLE_HOME} = "/opt/oracle/product/10.2.0/client_1"; $ENV{LD_LIBRARY_PATH} = "/opt/oracle/product/10.2.0/client_1/l +ib32:/usr/local/lib/sprolib:/usr/local/lib:/usr/lib:/usr/openwin/lib: +/usr/dt/lib:/usr/lib:/usr/ucblib"; exec $0, @ARGV; # <--- } } use DBI; # ...

Or simply use a shell wrapper around your Perl script:

#!/bin/sh export ORACLE_HOME=/opt/oracle/product/10.2.0/client_1 export LD_LIBRARY_PATH=/opt/oracle/product/10.2.0/client_1/lib32:/usr/ +local/lib/sprolib:/usr/local/lib:/usr/lib:/usr/openwin/lib:/usr/dt/li +b:/usr/lib:/usr/ucblib /path/to/your/script.pl

As for the ELFCLASS64 error, the reason is that the (64-bit) lib is being found in /opt/oracle/product/10.2.0/client_1/lib, instead of the 32-bit one in the .../lib32 directory that you tried to specify via LD_LIBRARY_PATH — because setting the env variable too late (after exec of perl) doesn't have any effect, as already mentioned.

Replies are listed 'Best First'.
Re^4: Env Variables
by LinuxUser2008 (Acolyte) on Jun 10, 2010 at 17:29 UTC
    Thanks almut, But i did not understand the point of the last line in the BEGIN segment.. Could you please explain that??

    Regards,
    Blub:)

      exec runs a new program in the same process (PID doesn't change), i.e. it replaces the running program with another one.  In this particular case, the "new" program is the old one, your script, which is available in $0.

      The effect of this seemingly senseless exercise is that the runtime linker this time reads the updated LD_LIBRARY_PATH (which it only reads once on exec of a binary).

        Thnks to you, i got it resolved.. Good Day almut..
        Thnks to you, i got it resolved.. Good Day almut..

        Regards,
        Blub:)