I am writing a cross-platform build script in Perl for code compilation.
In Windows, I need to execute vsvars32.bat to set the environment variables:
sub set_win_env {
#MSVC version 9.0 is installed
$VS90COMNTOOLS = $ENV{'VS90COMNTOOLS'};
$VS90COMNTOOLS .= "vsvars32.bat"
if($VS90COMNTOOLS ne "") {
system("$VS90COMNTOOLS");
}
}
The environment variables set by executing the batch files gets lost as interpreter spawns another shell to execute the batch file.
How can I import those variables in the parent Perl script?