Code Comments
Programming Forum and web based access to our favorite programming groups.Hi Thread GURUS,
I'm using Linux OS. Does anyone know how to set environment
variables in threads that can be utilized by the system() function.
I have the following code.
This sets all my environment variables and set them correctly.
foreach ( @RESULT )
{
my ($ENV_VAR, $ENV_VAL) = split(/\=/);
chomp(${ENV_VAL});
$ENV{${ENV_VAR}} = ${ENV_VAL};
# print "Each line is \"${ENV_VAR}\"=\"${ENV_VAL}\"\n";
}
This prints out everything correctly.
print `env`;
print "ENV{'DIR'} is $ENV{'DIR'}\n";
I run 3 threads.
foreach my $PLATFORM ( @BLD_PLATFORMS )
{
push (@THREADS, threads->create(\&BUILD,
${BLD_CMD}, ${PLATFORM}));
}
When I call the "system" command, the environment variables I set
doesn't exist? Any idea what I did wrong? How can use or set the env.
variables, so these variables can be used with the system call? any help
or insight will be greatly appreciated.
sub BUILD
{
...more code
system ("make ...");
}
- - - - - Appended by Scientific Atlanta, a cisco company - - - - -
This e-mail and any attachments may contain information which is confidentia
l,
proprietary, privileged or otherwise protected by law. The information issol
ely
intended for the named addressee (or a person responsible for delivering it
to
the addressee). If you are not the intended recipient of this message, you a
re
not authorized to read, print, retain, copy or disseminate this message or a
ny
part of it. If you have received this e-mail in error, please notify the sen
der
immediately by return e-mail and delete it from your computer.
Post Follow-up to this messageThis is a known deficiency: http://rt.perl.org/rt3/Ticket/Display.html?id=41222 > I'm using Linux OS. Does anyone know how to set environment > variables in threads that can be utilized by the system() function. You have set them in the main thread.
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.