Do you know where your variables are? | |
PerlMonks |
set env var at compile timeby SantaClaus (Initiate) |
on Jun 26, 2008 at 20:46 UTC ( [id://694276]=perlquestion: print w/replies, xml ) | Need Help?? |
SantaClaus has asked for the wisdom of the Perl Monks concerning the following question: I have a script that uses DBI and DBD::Oracle. My sysadmin had some trouble getting DBD::Oracle to work, and in the end used a LD_LIBRARY_PATH=$ORACLE_HOME hack over which I have no control. The trouble is that DBD::Oracle is now compiled with this, and I can not run my script without setting that env var. I plan to run the script in cron, and I know I can just do "env LD_LIBRARY_PATH=<path_to_oracle> my_script.pl." It works, I've tested it. We have other scripts that run that way now. But that just seems ugly to me. The script already has many configuration options set in a conf file, and it seems more elegant and consistent to set LD_LIBRARY_PATH in there. My shop also has standard modules for Oracle connections and config files that I'd like to use. I've tried:
But this dies at compile time with the usual "can't load '/usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/auto/DBD/Oracle/Oracle.so' for module DBD::Oracle: libclntsh.so.10.1: cannot open shared object file: No such file or directory at /usr/lib/perl5/5.8.5/i386-linux-thread-multi/DynaLoader.pm line 230. at /usr/lib/perl5/site_perl/5.8.5/Our/Oracle/Module.pm line 27 Compilation failed in require at /usr/lib/perl5/site_perl/5.8.5/Our/Oracle/Module.pm line 27." that I always see when LD_LIBRARY_PATH is not set. So I'm assuming that's not an acceptable way to set env vars before use-ing modules that rely on them. I strongly prefer to maintain portability by keeping machine specific stuff in a config file that I can modify without making code changes. Remember too that I have actual sysadmins, so I have no control over the Perl installation and don't want to maintain a separate one. With these restrictions, can anyone propose a clean way to set the env var that does not involve hard coding the path, either in the script or in the cron job? Or am I just letting an unaccountable fastidiousness lure me away from a perfectly good solution that I know works?
Back to
Seekers of Perl Wisdom
|
|