Am 28.05.2010 um 09:45 schrieb newbie01 perl:
> Can someone advise how to set LD_LIBRARY_PATH from within the Perl scripts?
> But if I do the following instead in the Perl script, it does not work? How
> to set the LD_LIBRARY_PATH then?
>
> $ENV{ORACLE_HOME}=$ORACLE_HOME;
> $ENV{ORACLE_SID}=$ORACLE_SID;
> $ENV{PATH}="$ORACLE_HOME/bin:$PATH";
> $ENV{LD_LIBRARY_PATH}="$ORACLE_HOME/lib";
Try putting the %ENV adjustment in a BEGIN block that executes before you load
the Oracle driver.
> FYI, the script is to run from a cron which is why am setting
> LD_LIBRARY_PATH in the script.
You could do one of two things instead of tweaking %ENV in your Perl script:
(1) In your crontab, set the variables in the cronline:
* * * ... BLA=eins BLUB=zwei /usr/local/bin/script.pl
(2) Call a shell script from the crontab that sets up the environment for your
Perl script and then calls it.
I'd go for (2).
--
Michael.Ludwig (#) XING.com