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);

    # or use with 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.

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.

SEE ALSO

Mnet

Mnet::Opts::Cli

Mnet::Test