I have a problem in pre-pending to PATH for a captive script. I'm trying to append the location of the perl executable I wish to use to the beginning of the PATH and then exec it to pick up the change. Since this perl script is called directly in a captive environment I am unable to set these environment variables in calling script first. This method works fine for other environment variables (I picked this code up from a response to another question by Tye) but not for the PATH.
# Set up the perl executable and library path
BEGIN {
$ENV{PATH} = "/mypath/perl/bin:$ENV{PATH}";
$ENV{PERL5LIB} = '/mypath/perl/lib/site_perl/5.8.8/sun4-solari
+s:/mypath/perl/lib/site_perl/5.8.8:/mypath/perl/lib/site_perl:/mypath
+/perl/lib/5.8.8:/mypath/perl/lib/site_perl';
exec 'env', $^X, $0, @ARGV;
}
The problem is that when I do the above the executable never returns and I cannot figure out what it is doing. I suspect it is constantly re executing itself in an infinite loop
Any help appreciated
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.