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:
unixLow-level layer that calls
read,write,lseek, etc.stdioCalls
fread,fwrite,fseek,ftell, etc.stdiowill use your operating system’s I/O via the C library. That is, you cannot place any layers beneathstdio.perlioA reimplementation of a
stdio-like buffering written as a PerlIO layer. As such, it will call whatever layer is below it for its operations.crlfDoes CRLF translation depending on distinguishing text, and binary files a la MS-DOS.
utf8Declares that the stream accepts Perl’s internal encoding of characters (which is really
UTF-8on ASCII machines andUTF-EBCDICon EBCDIC machines). This allows any character Perl can represent to be read from or written to the stream. TheUTF-Xencoding is chosen to render simple text parts (i.e., nonaccented letters, digits, and common punctuation) human-readable in the encoded file.rawA 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",...);
rawforces the use of theperliolayer even if the platform default or theuse opendefault is something else (such ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access