Perl in a Nutshell

Perl in a NutshellSearch this book
Previous: 8.91 IO::FileChapter 8
Standard Modules
Next: 8.93 IO::Pipe
 

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.

MethodDescription
closeCloses file or pipe
eofReturns 1 if next read will return end-of-file
filenoReturns file descriptor for a filehandle
getcReturns next character from input file
printPrints a string or comma-separated list of strings
printfPrints a formatted string
readReads data from a filehandle
statReturns an array of status information for a file
sysreadReads data from a filehandle with system call read(2)
syswriteWrites data to a filehandle with system call write(2)
truncateTruncates a file to a specified length

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

MethodDescription
autoflush

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

format_page_numberCurrent page number
format_lines_per_pageCurrent page length (default 60)
format_lines_leftNumber of lines left on page
format_nameName of current report format
format_top_nameName of current top-of-page format
format_line_break_characters

Current set of linebreak chars for a format

format_formfeed

Formfeed char used by formats (default \f)

format_writeWrapper for write function
input_record_separatorInput record separator (default newline)
input_line_number

Current input line number for last filehandle accessed

output_field_separator

Output field separator for print

output_record_separator

Output record separator for print


Previous: 8.91 IO::FilePerl in a NutshellNext: 8.93 IO::Pipe
8.91 IO::FileBook Index8.93 IO::Pipe