NAME

Test::Builder2::CanDupFilehandles - A role for duplicating filehandles

SYNOPSIS

package Some::Thing;

use Test::Builder2::Mouse;
with 'Test::Builder2::CanDupFilehandles';

DESCRIPTION

This role supplies a class with the ability to duplicate filehandles in a way which also copies IO layers such as UTF8.

It's most handy for Streamers.

METHODS

dup_filehandle

my $duplicate = $obj->dup_filehandle($fh);

Creates a duplicate filehandle including copying any IO layers.

autoflush

$obj->autoflush($fh);

Turns on autoflush for a filehandle.