NAME

PerlIO::Layers - Querying your filehandle's capabilities

VERSION

Version 0.003

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)

This query a filehandle for some information. Currently supported queries include:

  • utf8

    Check whether the filehandle handles unicode

  • crlf

    Check whether the filehandle does crlf translation

  • binary

    Check whether the filehandle is binery. This test is pessimistic (for unknown layers it will assume it's not binary).

  • buffered

    Check whether the filehandle is buffered.

  • readable

    Check whether the filehandle is readable.

  • writeable

    Check whether the filehandle is writeable.

  • open

    Check whether the filehandle is open.

  • temp

    Check whether the filehandle refers to a temporary file.

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:

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.