Michael G Schwern > Test-Simple-1.005000_006 > TB2::CanDupFilehandles

Download:
Test-Simple-1.005000_006.tar.gz

Dependencies

Annotate this POD

Website

View/Report Bugs
Module Version: 1.005000_006   Source  

NAME ^

TB2::CanDupFilehandles - A role for duplicating filehandles

SYNOPSIS ^

    package Some::Thing;

    use TB2::Mouse;
    with 'TB2::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($src);
    my $duplicate = $obj->dup_filehandle($src, $duplicate);

Creates a duplicate filehandle including copying any IO layers.

If you hand it an existing $duplicate filehandle it will overwrite it and return it. If it's undef, it will return a new one. This is handy as it will preserve the glob and fileno.

autoflush

    $obj->autoflush($fh);

Turns on autoflush for a filehandle.

syntax highlighting: