mpeters has asked for the wisdom of the Perl Monks concerning the following question:

I have a script which uses Business::OnlinePayment::PayflowPro which in turn uses a .so file from PayflowPro. It's easy enough for Dynaloader to link to it if it's in the standard lib location, but I want this project to be self-contained, so I'm not putting it in the standard location.

I can fix this if I set $ENV{LD_LIBRARY_PATH} in my shell or the process that spawns this script, but I would like to be able to do it from within my script, but it doesn't work like that.

I assume that there's some DynaLoader incantation I can perform that will work, but I can't quite get my finger on it. Any ideas?

-- More people are killed every year by pigs than by sharks, which shows you how good we are at evaluating risk. -- Bruce Schneier