develooper Front page | perl.ithreads | Postings from April 2008

Environment Variables

Thread Next
From:
Wong, Danny H.
Date:
April 3, 2008 22:04
Subject:
Environment Variables
Message ID:
D331130DD3DA194B96EF57DA3415F50A021CB81C@SAUSCUPEXCH01.corp.sa.net
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 confidential,
proprietary, privileged or otherwise protected by law. The information is solely
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 are
not authorized to read, print, retain, copy or disseminate this message or any
part of it. If you have received this e-mail in error, please notify the sender
immediately by return e-mail and delete it from your computer.
Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About