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

NAME

Test::Builder2::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.

Test::Builder2::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

Test::Builder2::Streamer::Print Print to a configurable output filehandle

Test::Builder2::Streamer::TAP A streamer for the special needs of TAP

Test::Builder2::Streamer::Debug Captures all output, useful for debugging.