in reply to exec problem

The exec is working fine, in fact it is working fine every single time the script runs, so you run the script, it sets the environment, then it runs the script, which sets the environment, then runs the script, and so on on forever.


We're not surrounded, we're in a target-rich environment!

Replies are listed 'Best First'.
Re: exec problem
by crenz (Priest) on Mar 13, 2003 at 22:27 UTC

    "A supercomputer is a machine that runs an infinite loop in two seconds" ;-)

    If you don't have a supercomputer at hand, consider modifying @ARGV and checking it so you can differentiate between the first and the second instance of the program:

    BEGIN { unless ($ARGV[0] eq "-2ndcall") { print "\n ... starting BEGIN\n"; $ENV{LD_LIBRARYN32_PATH} = qw( /usr/path1 /opt/path2); unshift @ARGV, "-2ndcall"; exec 'env', $^X, $0, @ARGV; } }

    Update: Fixed stupid mistake.