The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

TB2::Streamer - Role to output formatted test results

SYNOPSIS

    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";
        }
    }

DESCRIPTION

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").

Required Methods

You are only required to write a single method:

write

    $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.

SEE ALSO

TB2::Streamer::Print Print to a configurable output filehandle

TB2::Streamer::Debug Captures all output, useful for debugging.