home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam    

8.92 IO::Handle

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:

IO::Handle also provides the following methods, which are not described in detail here because they are simply front-ends for the corresponding built-in functions. See Chapter 5, Function Reference , for more information.

Method Description
close Closes file or pipe
eof Returns 1 if next read will return end-of-file
fileno Returns file descriptor for a filehandle
getc Returns next character from input file
print Prints a string or comma-separated list of strings
printf Prints a formatted string
read Reads data from a filehandle
stat Returns an array of status information for a file
sysread Reads data from a filehandle with system call read(2)
syswrite Writes data to a filehandle with system call write(2)
truncate Truncates a file to a specified length

Finally, the following methods act on the equivalent Perl variables. See Chapter 4 for more information.

Method Description

If nonzero, forces a flush now and after each write or print (default 0)

format_page_number Current page number
format_lines_per_page Current page length (default 60)
format_lines_left Number of lines left on page
format_name Name of current report format
format_top_name Name of current top-of-page format

Current set of linebreak chars for a format


Formfeed char used by formats (default \f )

format_write Wrapper for write function
input_record_separator Input record separator (default newline)

Current input line number for last filehandle accessed


Output field separator for print


Output record separator for print