So I need to call some perl scripts from another script. To make it work from the terminal I need to go to bash and then change the PATH:
export PATH=$PATH:/home/lsk250/www/portfolio
Now I need to run this as a CGI and invoke it from a browser, but obviously when I try to invoke the script from the browser, the PATH is not set so the script can’t find the programs needed. How can I change the PATH from inside a perl script?
I tried the following, without success:
system "export PATH=\$PATH:/home/lsk250/www/portfolio";
and
$ENV{PATH} = '/home/lsk250/www/portfolio';
exec 'env',cwd().'/'.$0,@ARGV;
Any ideas?
is indeed correct. It’s Perl’s equivalent to
sh‘sContrary to what you said, the subsequent
execwill use this path to locate the executable, and that executable will see the updated PATH.You seem to have misdiagnosed the problem. What is actually happpening? Is the
execfailing? If so, what error did it return?