The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

IO::File::Cached - an caching file IO handle

SYNOPSIS

    use IO::File::Cached;

    # Open a file and read it line by line
    my $fh = IO::File::Cached->new(filename => $filename,
                                   cache => $cache);
    while (defined ($_ = $fh->read)) {
        print "Got line: $_\n";
    }
    $fh->close;

DESCRIPTION

The IO::File::Cached module is a subclass of the IO::Scalar module that uses IO::File and Cache::Cache modules to access the contents of a file. The first time it is called for a particular file name it will load the file as normal using IO::File. The entire contents of the file will then be stored in the supplied cache object, such that later loads do not have to read from disk. One situation in which this can be useful is to cache files in memory across all processes in a mod_perl server.

METHODS

new(filename => $filename[, cache => $cache] );

Creates a new IO::File::Cached object. If the cache parameter is supplied, this cache object will be used to load and store the file contents. At this time, instances of IO::File::Cached are read only. The object specified by the 'cache' parameter should be an instance of the Cache::Cache module.

AUTHORS

Daniel Berrange <dan@berrange.com>

COPYRIGHT

Copyright (C) 2004 Daniel P. Berrange <dan@berrange.com>

SEE ALSO

perl(1), IO::Scalar, Cache::Cache, IO::File

1 POD Error

The following errors were encountered while parsing the POD:

Around line 124:

=back doesn't take any parameters, but you said =back 4