Modifying paths before loading perl modules

I'm trying to set a specific LD_LIBRARY_PATH to load a modified version of libpcap instead of the system-wide one.

This works of course if I run the whole script with LD_LIBRARY_PATH=/blah ./script_name. I want to make this transparent for the user, so I tried setting $ENV{'LD_LIBRARY_PATH'}. This doesn't however change the behaviour. I tried to put it in the BEGIN block to make it work before other use-s, but no luck there either.

I suspect it's because of ld loading all the configs / configuring itself at the beginning of the process before any part of the script is run. Is there some way to make it work?

I'd like to avoid silly things like:

if (check_parent()) { $ENV...=.... ; `$0` ; exit }

(or external wrappers as have been suggested - the less cruft and random wrappers, the better)


You could replace the top of your script with

exec perl -x -S "$0" "$@" || exit 1

# rest of your script

Need Your Help

Create automation macro support within an application

c# .net c++ vba automation

I need to get an automation macro like thing within our desktop application. The desktop app will probably be in VB.NET or

What is the difference between Flash Builder 4.5 Premium and Flash Builder 4.5 Premium for PHP?

flex table comparison flash-builder

I can't, for the life of me, find a decent feature comparison table of the Flash Builder 4.5 Premium and the Flash Builder 4.5 Premium for PHP (or it might be my poor site navigation skills). Can a...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.