# Save the previous filehandles for STDOUT and STDERR so we # can restore them when we're done. local *REAL_STDOUT; local *REAL_STDERR; open(REAL_STDOUT, ">&STDOUT"); open(REAL_STDERR, ">&STDERR"); $this->{'_stdout'} = *REAL_STDOUT; $this->{'_stderr'} = *REAL_STDERR; # Set the new filehandles for STDOUT and STDERR local *STDOUT_LOG; local *STDERR_LOG; *STDOUT_LOG = $this->{'stdout_log'}; *STDERR_LOG = $this->{'stderr_log'}; open(STDOUT, ">&STDOUT_LOG"); open(STDERR, ">&STDERR_LOG");