in reply to Class::DBI::Oracle environment variable issue

Howdy!

Given your findings, what you need to do in the BEGIN block is something along the following lines:

BEGIN { if ($ENV{LD_LIBRARY_PATH} doesn't contain the necessary thingy and $ENV{ORACLE_HOME} doesn't contain the necessary thingy) { set $ENV as above exec $0, @_; } }

This re-executes the script, but the environment has been changed. Double check the syntax for all the bits; the concept of "diddle %ENV and exec myself" will do the trick. I know I had to do stuff like that with Sybase.

yours,
Michael

Replies are listed 'Best First'.
Re^2: Class::DBI::Oracle environment variable issue
by mildside (Friar) on Nov 22, 2005 at 23:01 UTC
    Thanks herveus, this has worked a treat! I changed the 'and' to an 'or', and slightly changed the 'exec', but otherwise followed your example pretty closely. My new BEGIN block follows:
    BEGIN { if (!defined($ENV{'ORACLE_HOME'}) || !defined($ENV{'LD_LIBRARY_PA +TH'})) { $ENV{'ORACLE_HOME'} = "/users/oracle/product/9.2.0"; $ENV{'LD_LIBRARY_PATH'} = $ENV{'ORACLE_HOME'} . "/lib"; exec($^X, $0, @ARGV); } }
    Thanks again,
    mildside