Leon Timmermans > PerlIO-Layers-0.011 > PerlIO::Layers

Download:
PerlIO-Layers-0.011.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Module Version: 0.011   Source  

NAME ^

PerlIO::Layers - Querying your filehandle's capabilities

VERSION ^

version 0.011

SYNOPSIS ^

 use PerlIO::Layers qw/query_handle/;

 if (!query_handle(\*STDOUT, 'binary')) {
     ...
 }

DESCRIPTION ^

Perl's filehandles are implemented as a stack of layers, with the bottom-most usually doing the actual IO and the higher ones doing buffering, encoding/decoding or transformations. PerlIO::Layers allows you to query the filehandle's properties concerning these layers.

FUNCTIONS ^

query_handle($fh, $query_name [, $argument])

This query a filehandle for some information. All queries can take an optional argument, that will test for that layer's properties instead of all layers of the handle. Currently supported queries include:

get_layers($fh)

Gets information on the layers of a filehandle. It's a list with whose entries have 3 elements: the name of the layer, the arguments of the layer (may be undef) and an arrayref with the flags of the layer as strings. The flags array can contain any of these values:

query_handle provides a more high level interface to this, you should probably use that when you can.

get_buffer_sizes($fh)

Returns a list of buffer sizes for all buffered layers. Unbuffered layers are skipped.

AUTHOR ^

Leon Timmermans <fawaka@gmail.com>

COPYRIGHT AND LICENSE ^

This software is copyright (c) 2010 by Leon Timmermans.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

syntax highlighting: