NAME
Test::Builder2::Streamer::Print - A simple streamer that prints
DESCRIPTION
This is a Test::Builder2::Streamer which prints to a filehandle.
You are encouraged to subclass this Streamer if you're writing one which prints.
Destinations
It ignores your destination. Everything goes to the output_fh.
Attributes
output_fh
The filehandle to which it should write.
Defaults to a copy of STDOUT
. This allows tests to muck around with STDOUT without it affecting test results.
stdout
Stores a duplicated copy of STDOUT
. Handy for resetting the output_fh().
Methods
safe_print
$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.
Subclasses are encouraged to take advantage of this method rather than calling print themselves.