../lib/FileHandle.pm
FileHandle - supply object methods for filehandles
cacheout - keep more files open than the system permits
use FileHandle;
autoflush STDOUT 1;
cacheout($path);
print $path @data;
See the perlvar manpage
for complete descriptions of each of the following supported FileHandle
methods:
autoflush
output_field_separator
output_record_separator
input_record_separator
input_line_number
format_page_number
format_lines_per_page
format_lines_left
format_name
format_top_name
format_line_break_characters
format_formfeed
Furthermore, for doing normal I/O you might need these:
-
$fh->print
-
See print.
-
$fh->printf
-
See printf.
-
$fh->getline
-
This works like <$fh> described in ``I/O Operators'' except that it's more readable
and can be safely called in an array context but still
returns just one line.
-
$fh->getlines
-
This works like <$fh> when called in an array context to
read all the remaining lines in a file, except that it's more readable.
It will also croak() if accidentally called in a scalar context.
The cacheout() Library
The cacheout() function will make sure that there's a filehandle
open for writing available as the pathname you give it. It automatically
closes and re-opens files if you exceed your system file descriptor maximum.
the perlfunc manpage
,
``I/O Operators'',
POSIX/``FileHandle''
sys/param.h lies with its NOFILE
define on some systems,
so you may have to set $cacheout::maxopen yourself.
Some of the methods that set variables (like format_name()) don't
seem to work.
The POSIX functions that create FileHandle methods should be
in this module instead.
Due to backwards compatibility, all filehandles resemble objects
of class FileHandle
, or actually classes derived from that class.
They actually aren't. Which means you can't derive your own
class from FileHandle
and inherit those methods.