3.4. The IO Subsystem

Recent versions of Perl come with a completely new standard IO implementation, PerlIO. This allows for several "layers" to be defined through which all IO is filtered, similar to the line disciplines mechanism in sfio. These layers interact with modules such as PerlIO::Scalar, also in the ext/ directory.

The IO subsystem is implemented in perlio.c and perlio.h. Declarations for defining the layers are in perliol.h, and documentation on how to create layers is in pod/perliol.pod.

Perl may be compiled without PerlIO support, in which case there are a number of abstraction layers to present a unified IO interface to the Perl core. perlsdio.h aliases ordinary standard IO functions to their PerlIO names, and perlsfio.h does the same thing for the alternate IO library sfio.

The other abstraction layer is the "Perl host" scheme in iperlsys.h. This is confusing. The idea is to reduce process overhead on Win32 systems by having multiple Perl interpreters access all system calls through a shared "Perl host" abstraction object. There is an explanation of it in perl.h, but it is best avoided.