Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Environment Variables
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.

Report this thread to moderator Post Follow-up to this message
Old Post
Wong, Danny H.
04-04-08 06:06 AM


Re: Environment Variables
This 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.

Report this thread to moderator Post Follow-up to this message
Old Post
Jerry D. Hedden
04-04-08 12:05 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

ithreads archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 08:42 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.