start page | rating of books | rating of authors | reviews | copyrights

Book HomeJava and XSLTSearch this book

8.170. PerlIO

An on-demand loader for PerlIO layers and the root of the PerlIO namespace. PerlIO allows you to expand the functionality of open(). For example:

use PerlIO 'special';

The code in PerlIO.pm then attempts to find 'special':

require PerlIO::special;

PerlIO currently defines the following layers:

unix
Low-level layer that calls read, write, lseek, etc.

stdio
Calls fread, fwrite, fseek, ftell, etc. stdio will use your operating system's I/O via the C library. That is, you cannot place any layers beneath stdio.

perlio
A reimplementation of a stdio-like buffering written as a PerlIO layer. As such, it will call whatever layer is below it for its operations.

crlf
Does CRLF translation depending on distinguishing text, and binary files a la MS-DOS.

utf8
Declares that the stream accepts Perl's internal encoding of characters (which is really UTF-8 on ASCII machines and UTF-EBCDIC on EBCDIC machines). This allows any character Perl can represent to be read from or written to the stream. The UTF-X encoding is chosen to render simple text parts (i.e., nonaccented letters, digits, and common punctuation) human-readable in the encoded file.

raw
A pseudo-layer that performs two functions. It forces the filehandle to be considered binary at that point in the layer stack, and it prevents the I/O system from searching before it in the layer specification. For example:

open($fh,":raw:perlio",...);

raw forces the use of the perlio layer even if the platform default or the use open default is something else (such as :encoding(iso-8859-7)).



Library Navigation Links

Copyright © 2002 O'Reilly & Associates. All rights reserved.