<?xml version="1.0" encoding="windows-1252"?>
<node id="1013046" title="passing env{} variable to child fails on linux,works on windows" created="2013-01-12 09:53:59" updated="2013-01-12 09:53:59">
<type id="115">
perlquestion</type>
<author id="748836">
sdetweil</author>
<data>
<field name="doctext">
I have this multi-platform application. it launches children that run for a short period of time. 
&lt;br&gt;&lt;br&gt;
I need to communicate from parent to child. 
&lt;br&gt;&lt;br&gt;
so just before launching the child, I do &lt;br&gt;
   $ENV{'varname'}='value';
&lt;br&gt;&lt;br&gt;
and in the child, I get the environment variable and all is well.
&lt;br&gt;&lt;br&gt;
this works on Windows without problem, 
but the variable does not show up for the linux child. 
in both cases I am actually starting a command shell script.
xxx.cmd on Windows and xxx.sh on linux. 
the set command dumps the environment, and on linux the variable is not set when xxx.sh is started. 
&lt;br&gt;&lt;br&gt;
I do not need the value to be persistent, and I understand the reasons and issues there. 
&lt;br&gt;&lt;br&gt;
one piece of info, the child is started with OPEN so that the parent can monitor the childs console output

&lt;code&gt;
	if($environmentDetails-&gt;GetValue() eq "Yes"){
		$ENV{'SKIP_SYSTEM'}='0';
        }
	else{
		$ENV{'SKIP_SYSTEM'}='1';
	}
	
    # have to execute the shell script from the current folder..
    # *ix is picky, you must be explicit
    open(CMD, ( ($^O eq 'MSWin32' ) ? "":"./")."$command 2&gt;&amp;1 |");
    while(&lt;CMD&gt;){
    	$detailsInfo-&gt;AppendText($_);
    }

&lt;/code&gt;

on perl 5.10, linux fedora 10, 32 bit (can't update for other reasons)

</field>
</data>
</node>
