This is an old thread, but I've often had reason to refer back to it. Hopefully someone will also find the following useful.
Tye's solution works perfectly. It seems to be the best solution for cron jobs on a server with a diverse environment. The only problem is the the BEGIN block sort of breaks the use of perl -c and perl -d. If I understand correctly, it's because those options sort of wrap the existing code in code that will just compile or debug the existing code.
The following works, but only if the environment variables don't need to be set before the modules are loaded. Naturally, on a Windows system you will need to find an alternative method of determining an interactive shell...
Credit for this goes to one of my (non-perlmonk) co-workers. I'm just taking the credit :D I've been using a variation of Tye's code until now.
-- -- GhodMode
In reply to Re: (tye)Re: programatically setting the LD_LIBRARY_PATH