Personal tools
Skip to content. | Skip to navigation
IO::Socket provides a way to set a timeout on the socket, but the timeout will be used only for connection, not for reading / writing operations.
The "IO::String" module provides the "IO::File" interface for in-core strings. An "IO::String" object can be attached to a string, and makes it possible to use the normal file operations for reading or writing data, as well as for seeking to various locations of the string. This is useful when you want to use a library module that only provides an interface to file handles on data that you have in a string variable. Note that perl-5.8 and better has built-in support for "in memory" files, which are set up by passing a reference instead of a filename to the open() call. The reason for using this module is that it makes the code backwards compatible with older versions of Perl.
This toolkit primarily provides modules for performing both traditional and object-oriented I/O) on things *other* than normal filehandles; in particular, IO::Scalar, IO::ScalarArray, and IO::Lines. In the more-traditional IO::Handle front, we have IO::AtomicFile, which may be used to painlessly create files that are updated atomically. And in the "this-may-prove-useful" corner, we have IO::Wrap, whose exported wraphandle() function will clothe anything that's not a blessed object in an IO::Handle-like wrapper... so you can just use OO syntax and stop worrying about whether your function's caller handed you a string, a globref, or a FileHandle.
This is the Perl POSIX compliant stty.
IO::Tee objects can be used to multiplex input and output in two different ways. The first way is to multiplex output to zero or more output handles. The IO::Tee constructor, given a list of output handles, returns a tied handle that can be written to. When written to (using print or printf), the IO::Tee object multiplexes the output to the list of handles originally passed to the constructor. As a shortcut, you can also directly pass a string or an array reference to the constructor, in which case IO::File::new is called for you with the specified argument or arguments.
This package allows you to tie separate variables into a combined whole, using ties and other magic. This can be very useful when, say, you want a unified output from various different things that return data in different ways (STDIN/ERR, scalars, handles, etc).