Data::Library::OnePerFile - one-item-per-file repository support class
Provides a general repository service. This package supports source data in files, where each file contains a single source item. A tag corresponds to a filename (tag.EXTENSION where EXTENSION is specified at initialization). Searching will be done through a list of directories. The first matching file will be used. Conflicts are not detected.
OnePerFile recognizes when a source file is changed.
my $library = new Data::Library::OnePerFile ({ name => "value" ... });
Supported Library::OnePerFile parameters:
LIB Search path for data files. Defaults to current directory. EXTENSION Filename extension for data files. Defaults to "data".
$library->lookup($tag);
Returns cached data items. If the source has changed since it was cached, returns false.
$library->find($tag);
Searches through the directory path in LIB for a file named "$tag.EXTENSION". Returns the contents of that file if successful, and records the path for subsequent checking by lookup().
$library->cache($tag, $data);
Caches data by tag for later fetching via lookup().
my @array = $library->toc();
Search through the library and return a list of all available entries. Does not import any of the items.
$library->reset;
Erase all entries from the cache.
Jason W. May <jmay@pobox.com>
Copyright (C) 2001,2002 Jason W. May. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
2 POD Errors
The following errors were encountered while parsing the POD:
'=item' outside of any '=over'
You forgot a '=back' before '=head1'
To install Data::Library, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Data::Library
CPAN shell
perl -MCPAN -e shell install Data::Library
For more information on module installation, please visit the detailed CPAN module installation guide.