NAME
Mnet::Tee - Redirect stdout and stderr to a file
SYNOPSIS
# use this module on it's own
use Mnet::Tee;
Mnet::Tee::file($file);
# ot use with Mnet command line options
use Mnet::Tee;
use Mnet::Opts::Cli;
my $cli = Mnet::Opts::Cli->new;
DESCRIPTION
Mnet::Tee can be used to capture all stdout and stderr output from the calling script, saving the combined output to a file. This module is used by the Mnet::Test module, and also works with the Mnet::Batch module.
The variables stdout and stderr can be imported from this module to use for output that should not be captured by the Mnet::Tee module.
Note that output captured by this module is stored in memory during script execution. That could be a problem for scripts that generate gigabytes of stdout and/or stderr output.
The perl tie command is used to implement the functionality of this module.
FUNCTIONS
Mnet::Tee implements the functions listed below.
file
Mnet::Tee::file($file)
The function can be used to have script output written to the specified file, including all output prior to the call. The script will abort if unable to open the new file.