Need to understand this subroutine

August 11, 2012 at 19:41:12
Specs: Windows XP
I am new to Perl and want to understand this subroutine.
This subroutine sets up Visual Studio 2005 environment and I want to modify to Visual Studio 2010. I have changed "VS80COMNTOOLS" to VS100COMNTOOLS but it doesn't help.
Can you please explain these lines?

if($line =~ /@(set|SET)\W+(\w+)=(.+)/)
$value =~ s/\%(\w+)\%;?//;

sub setupEnvironment
{
if($GENERATOR =~ /(NMake|Visual)/i)
{
my $VCVARS = $ENV{'VS80COMNTOOLS'} . 'vsvars32.bat';

open VCVARS, "<$VCVARS";
while(<VCVARS>)
{
my $line = $_;
if($line =~ /@(set|SET)\W+(\w+)=(.+)/)
{
my $var = $2;
my $value= $3;
$value =~ s/\%(\w+)\%;?//;
if(!($ENV{$var} =~ m/\Q$value/))
{
$ENV{$var} = "$value;$ENV{$var}";
}
if($bVerbose) { print "ENV\{$var\}=$ENV{$var}\n"; }
}
}
close VCVARS;
}
}

Thanks,
Suba


See More: Need to understand this subroutine

Report •

#1
November 17, 2012 at 06:28:28
I don't know if it helps, but the error that came up for me was in this line

$value =~ s/\%(\w+)\%;?//;

:: mike


Report •
Related Solutions


Ask Question