The basic IPC facilities of Perl are built out of the good old Unix
signals, named pipes, pipe opens, the Berkeley socket routines, and SysV
IPC calls. Each is used in slightly different situations.
If you are running under version 5.000 (dubious) or 5.001, you can still
use most of the examples in this document. You may have to remove the
use strict and some of the my() statements for 5.000, and for both
you'll have to load in version 1.2 of the Socket.pm module, which
was/is/shall-be included in perl5.001o.
Most of these routines quietly but politely return
undef when they fail
instead of causing your program to die right then and there due to an
uncaught exception. (Actually, some of the new Socket conversion
functions croak() on bad arguments.) It is therefore essential
that you should check the return values fo these functions. Always begin
your socket programs this way for optimal success, and don't forget to add
-T taint checking flag to the pound-bang line for servers:
All these routines create system-specific portability problems. As noted
elsewhere, Perl is at the mercy of your C libraries for much of its system
behaviour. It's probably safest to assume broken SysV semantics for
signals and to stick with simple TCP and UDP socket operations; e.g. don't
try to pass open filedescriptors over a local UDP datagram socket if you
want your code to stand a chance of being portable.
Because few vendors provide C libraries that are safely
re-entrant, the prudent programmer will do little else within
a handler beyond die() to raise an exception and longjmp(3) out.
Tom Christiansen, with occasional vestiges of Larry Wall's original
Besides the obvious functions in the
, you should also check out
the modules file at your nearest CPAN site. (See the
yet, the Perl FAQ for a description of what CPAN is and where to get it.)
Section 5 of the modules file is devoted to
Networking, Device Control (modems) and Interprocess Communication,
and contains numerous unbundled
modules numerous networking modules,
Chat and Expect operations,
CGI programming, DCE, FTP, IPC,
Proxy, Ptty, RPC, SNMP, SMTP, Telnet,
Threads, and ToolTalk--just to name a few.