TB2::Streamer - Role to output formatted test results
package My::Streamer; sub write { my($self, $destination, @text) = @_; if( $destination eq 'output' ) { print STDOUT @text; } elsif( $destination eq 'error' ) { print STDERR @text; } else { croak "I don't know how to stream to $destination"; } }
A streamer object is used to output formatted test results (or really any text). You can use it to just spit stuff to STDOUT and STDERR, trap stuff for debugging, or... uhh... something else.
TB2::Streamer is just a role, you must write your own streamer or use one of the existing ones (see "SEE ALSO").
You are only required to write a single method:
$self->write( $destination => @output );
This method accepts @output and streams it to the given $destination.
The $destination has meaning specific to the Streamer.
It must throw an exception if it fails.
TB2::Streamer::Print Print to a configurable output filehandle
TB2::Streamer::TAP A streamer for the special needs of TAP
TB2::Streamer::Debug Captures all output, useful for debugging.
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.