NAME ^

Parrot::IO::Capture::Mini - capture messages printed to STDOUT or STDERR during Parrot testing

SYNOPSIS ^

    use Parrot::IO::Capture::Mini;

Tie STDOUT or STDERR.

    $tie = tie *STDERR, "Parrot::IO::Capture::Mini" or croak "Unable to tie";

Call a function which is likely to generate a warning or error message.

    $self = Parrot::Ops2c::Utils->new( {
        argv            => [ qw( CSwitch  dan.ops dan.ops ) ],
        flag            => { dynamic => 1 },
    } );

Store what was captured in a variable, then untie.

    $msg = $tie->READLINE;
    untie *STDERR or croak "Unable to untie";

Use that variable in a test.

    like($msg,
        qr/Ops file 'dan\.ops' mentioned more than once!/,
        "Got expected error message about mentioning same file twice");

DESCRIPTION ^

This package provides the bare minimum level of functionality needed to capture messages printed to STDOUT or STDERR by Parrot build tools written in Perl 5.

AUTHOR ^

Adapted by Jim Keenan from CPAN module IO::Capture::Tie_STDx. Thanks as always to the authors of IO::Capture, Mark Reynolds and Jon Morgan!

SEE ALSO ^

IO::Capture (http://search.cpan.org/dist/IO-Capture/).


parrot