in reply to %ENV and DBI

On Solaris, changing LD_LIBRARY_PATH from within a process doesn't work, because the dynamic linker is caching the info. In other words, you have to set it before, e.g. in a shell wrapper, or some such. Fork-and-exec (as opposed to simply forking) should also work though, I suppose.

Update: As to re-exec-ing yourself, here's one way you could do it (tested on Solaris 10):

#!/usr/bin/perl BEGIN { my $orahome = "/path/to/orahome"; my $oralib = "$orahome/lib"; unless ($ENV{LD_LIBRARY_PATH} =~ /$oralib/) { $ENV{ORACLE_HOME} = $orahome; $ENV{LD_LIBRARY_PATH} = $oralib; exec $0, @ARGV; } } use DBD::Oracle;

Replies are listed 'Best First'.
Re^2: %ENV and DBI
by Anonymous Monk on Mar 29, 2008 at 03:16 UTC
    Thanks almut! I was close. Instead of this:
    $ENV{ORACLE_HOME} = $orahome; $ENV{LD_LIBRARY_PATH} = $oralib; exec $0, @ARGV;

    I was trying this:
    exec("export ORACLE_HOME=$orahome LD_LIBRARY_PATH=$oralib; $0");

    Thanks again, your solution works.