NAME
PerlIO::Layers - Querying your filehandle's capabilities
VERSION
Version 0.007
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 there layers.
SUBROUTINES
query_handle($fh, $query_name [, $layer])
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:
layer
Check the presence of a certain layer. Unlike all other properties $layer is mandatory for this query.
utf8
Check whether the filehandle/layer handles unicode
crlf
Check whether the filehandle/layer does crlf translation
binary
Check whether the filehandle/layer is binary. This test is pessimistic (for unknown layers it will assume it's not binary).
mappable
Checks whether the filehandle/layer is memory mappable. It is the same as binary, except that the
utf8
layer is accepted.buffered
Check whether the filehandle/layer is buffered.
readable
Check whether the filehandle/layer is readable.
writeable
Check whether the filehandle/layer is writeable.
open
Check whether the filehandle/layer is open.
temp
Check whether the filehandle/layer refers to a temporary file.
can_crlf
Checks whether layer $argument (or any layer if $argument it not given) can do crlf translation.
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. You probably want to use query_layers instead. query_handle provides a more high level interface to this, you should probably use that when you can.
This function is deprecated and will be removed in a future version of PerlIO::Layers.
AUTHOR
Leon Timmermans, <leont at cpan.org>
BUGS
Please report any bugs or feature requests to bug-perlio-layers at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=PerlIO-Layers. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc PerlIO::Layers
You can also look for information at:
RT: CPAN's request tracker
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
LICENSE AND COPYRIGHT
Copyright 2010 Leon Timmermans.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.