Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: setting environment variable issue

by ikegami (Patriarch)
on Aug 09, 2011 at 20:54 UTC ( [id://919550]=note: print w/replies, xml ) Need Help??


in reply to setting environment variable issue

Option 1:

Before any use of DBI/DBD,

BEGIN { $ENV{ORACLE_HOME} = "..."; $ENV{LD_LIBRARY_PATH} = "..."; }

I think I heard this doesn't work. Something about a clone of the environment getting creating by the C runtime library before this, and this is what Oracle uses?

Option 2:

Set the environment before calling Perl.

ORACLE_HOME=... LD_LIBRARY_PATH=... perl ...

You could use a loader script for this.

Option 3:

Make the Perl script itself the loader script.

BEGIN { my $oracle_home = "..."; my $ld_library_path = "..."; if ($ENV{ORACLE_HOME} ne $oracle_home || $ENV{LD_LIBRARY_PATH} ne $ld_library_path ) { $ENV{ORACLE_HOME} = "..."; $ENV{LD_LIBRARY_PATH} = "..."; exec { $^X } $^X, $0, @ARGV; } }

Replies are listed 'Best First'.
Re^2: setting environment variable issue
by jaimon (Sexton) on Aug 11, 2011 at 08:48 UTC

    Oh thank you thank you thank you!!! Option 3 worked great!
    - J

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://919550]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2024-03-28 22:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found