Mnet::Tee - Redirect stdout and stderr to a file
# use this module on it's own use Mnet::Tee; Mnet::Tee::file($file); # or use with Mnet command line options use Mnet::Tee; use Mnet::Opts::Cli; my $cli = Mnet::Opts::Cli->new;
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.
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.
When used with the Mnet::Log module the --tee file will contain log entries that are not displayed to the terminal due to the use of the --quiet or --silent options.
When used with the Mnet::Batch module the output from the batch parent and all child processes will be merged into a single file.
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 and requires perl 5.010 or newer.
Mnet::Tee implements the functions listed below.
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.