IO::File::Cached - an caching file IO handle
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;
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.
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.
Daniel Berrange <dan@berrange.com>
Copyright (C) 2004 Daniel P. Berrange <dan@berrange.com>
perl(1), IO::Scalar, Cache::Cache, IO::File
1 POD Error
The following errors were encountered while parsing the POD:
=back doesn't take any parameters, but you said =back 4
To install IO::File::Cached, copy and paste the appropriate command in to your terminal.
cpanm
cpanm IO::File::Cached
CPAN shell
perl -MCPAN -e shell install IO::File::Cached
For more information on module installation, please visit the detailed CPAN module installation guide.