Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Environment Var Problem

by idsfa (Vicar)
on May 09, 2006 at 17:57 UTC ( #548289=note: print w/replies, xml ) Need Help??


in reply to Environment Var Problem

BEGIN { my $self = $0; # or hardcode it, depending upon need if ( $ENV{'LD_LIBRARY_PATH'} !~ m|/path/you/want| ) { $ENV{'LD_LIBRARY_PATH'} = "/path/you/want:$ENV{LD_LIBRARY_PATH}" +; exec $self, @ARGV; } } use DBI;

The intelligent reader will judge for himself. Without examining the facts fully and fairly, there is no way of knowing whether vox populi is really vox dei, or merely vox asinorum. — Cyrus H. Gordon

Replies are listed 'Best First'.
Re^2: Environment Var Problem
by Anonymous Monk on May 09, 2006 at 18:06 UTC
    That's interesting! How does it get past the exec statement? In other words, what prevents the process from getting stuck in a loop?

      It checks if the new path is in LD_LIBRARY_PATH before running itself again. Once the new path is there, it doesn't run itself anymore, breaking the loop.

        It works, but I didn't get the stdout from a print statement inserted before the exec.

        Slimey, but satisfying.

        Thanks for the help.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://548289]
help
Chatterbox?
[thezip]: Our cat is single-handedly (pawed-ly?) solving our field mouse problem. About four critters in the last week alone.
[thezip]: Amazing speed and stealth in that one.
[GotToBTru]: You can't tunafish, but some seafood companies can tunafish. More fun with English.
[virtualsue]: a veterinarian told me to cut down on my cat's food. i said, when i do that she just catches more mice
[thezip]: My dogs are also excellent mousers, at least that's what they tell me.
[GotToBTru]: our beagle has dispatched 3 rabbits to the Great Hutch in the Sky since March.

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (14)
As of 2017-11-17 19:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (272 votes). Check out past polls.

    Notices?