TB2::Streamer::Print - A simple streamer that prints
use TB2::Streamer::Print; my $streamer = TB2::Streamer::Print; $streamer->write( out => "something something" ); $streamer->write( err => "something's wrong!" ); # Redirect out to a new filehandle. $streamer->output_fh($fh);
This is a TB2::Streamer which prints to a filehandle.
You are encouraged to subclass this Streamer if you're writing one which prints.
These are the destinations understood by $streamer->write.
$streamer->write
Where normal output goes. This connects to $streamer->output_fh.
$streamer->output_fh
Where ad-hoc user visible comments go. This connects to $streamer->error_fh.
$streamer->error_fh
This is the filehandle for normal output. For example, TAP or XML or HTML or whatever records the test state.
Defaults to a copy of STDOUT. This allows tests to muck around with STDOUT without it affecting test results.
STDOUT
This is the filehandle for error output. This is normally human readable information about the test as its running. It is not part of the TAP or XML or HTML or whatever.
Defaults to a copy of STDERR. This allows tests to muck around with STDERR without it affecting test results.
STDERR
Contains a duplicated copy of STDOUT. Handy for resetting the output_fh().
It is read only.
Contains a duplicated copy of STDERR. Handy for resetting the error_fh().
$streamer->safe_print($fh, @hunks);
Works like print but is not effected by the global variables which change print's behavior such as $\ and $,. This allows a test to play with these variables without affecting test output.
print
$\
$,
Subclasses are encouraged to take advantage of this method rather than calling print themselves.
To install Test::Simple, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test::Simple
CPAN shell
perl -MCPAN -e shell install Test::Simple
For more information on module installation, please visit the detailed CPAN module installation guide.