in reply to reseting PATH

How will your Perl program know that it has already re-executed itself?

My approach would be to set a second environment variable to tell your program that it is already re-executing:

warn "$0 launched"; if (! $ENV{RE_EXECUTING}) { $ENV{RE_EXECUTING} = 1; warn "Set up environment. Re-executing now."; exec ... };

But maybe you want to just check whether the environment needs changing at all, and only if you need changes re-execute?

Replies are listed 'Best First'.
Re^2: reseting PATH
by Anonymous Monk on Apr 11, 2011 at 13:52 UTC
    Thanks. I knew the answer was staring me in the face.