in reply to Re^2: Side Effects
in thread Side Effects

OK, here's what I'm thinking.
$Body .= $_ while <LOG>;
is equivalent to
while ($_ = <LOG>) { $Body .= $_; }
Therefore, $_ is both an L-value and an R-value. If we assume for a moment that $_ is somehow an alias for $g::TaskList, then it should be correct that for each iteration of the while loop, $_ (and thus $g::TaskList) will get assigned the next line from <LOG>. At the end of the while loop, what would happen to $_? Would it get undef'd? Would this undef any aliases? So, let's assume all this is true... Here is my code path:
In Localize.pm: (SNIP) foreach my $lang (@g::LanguageList) { $g::Language = $lang; unless (isExcludedBuild($g::Product, $g::Architecture, $g::Flavor) + || $g::Architecture =~ /ia64/i || $g::Language =~ /usa/i) { (SNIP) &BuildBlah(); } } (SNIP) In Utilities.pm: sub BuildBlah { my $FlavorVariation = shift; (snip) if(FileExists("Blah")) { SendMail($g::MailPurpose{"BuildFailed"}, "Blah", $FlavorVariat +ion); } (snip) } In Reporting.pm: sub SendMail { my $Purpose = shift; my @OptionalParameters = @_; my $Body = ""; (snip) $Body = "<html> <body background=nothing bgproperties=\"fixed\">"; if($Purpose eq $g::MailPurpose{BuildNominated}) { (snip) } elsif($Purpose eq $g::MailPurpose{BuildFailed}) { (snip) open(LOG, "$LogDir\\$g::BuildErrFile"); while (my $line = <LOG>) { $Body .= "${line}<br>"; } close LOG; }
Although I've snipped a lot of code, this follows the execution path, and you can see that $g::TaskList is never mentioned going way way back up through several loops, modules and subroutine calls. Do I need to backtrack further? I would think the foreach above would wipe out any alias of $_ to TaskList that might have been set higher up in the stack trace.