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

Environment Variables

Thread Next
Wong, Danny H.
April 3, 2008 22:04
Environment Variables
Message ID:
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(/\=/);
                $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.

                        push (@THREADS, threads->create(\&BUILD,

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.

...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 Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About