The base class for all other IO handle classes. Its main purpose is for the other IO classes to inherit from it; programs should not create IO::Handle objects directly. Provides the following methods.
Constructor. Creates a new IO::Handle object.
new_from_fd (fd, mode)
Constructor. Like new, creates an IO::Handle object. It requires two parameters, which are passed to the method fdopen; if fdopen fails, the object is destroyed. Otherwise, it is returned to the caller.
Clears the given handle's error indicator.
Returns true if the given handle has experienced any errors since it was opened or since the last call to clearerr.
$fh->fdopen (fd, mode)
Like an ordinary open except that the first parameter is a filehandle name, an IO::Handle object, or a file descriptor number.
Flushes the given handle's buffer.
Works like <$fh>, described in the section on "I/O Operators" in the perlop manpage, but is more readable and can be safely called in an array context, while still returning one line.
Works like <$fh> when called in an array context to read all the remaining lines in a file, but is more readable. croak s if called in scalar context.
Returns true if the object is currently a valid file descriptor.
Pushes a character with the ordinal value ord back onto the given handle's input stream.
Special method for working under -T and setuid/gid scripts. Marks the object as taint-clean, and as such, data read from it is also considered taint-clean.
$fh->write (buf, len[, offset])
Like write found in C; that is, the opposite of read. The wrapper for the Perl write function is format_write.
IO::Handle also provides the following methods, which are not described in detail here because they are simply frontends for the corresponding built-in functions. See Chapter 5, "Function Reference" for more information.
Finally, the following methods act on the equivalent Perl variables. See Chapter 4, "The Perl Language" for more information.
Copyright © 2002 O'Reilly & Associates. All rights reserved.