NAME
File::HStore - Perl extension to store files on a filesystem using a very simple hash-based storage.
SYNOPSIS
use File::HStore;
my $store = File::HStore ("/tmp/.mystore");
my $id = $store->add("/foo/bar.txt");
$store->remove("ff3b73dd85beeaf6e7b34d678ab2615c71eee9d5")
DESCRIPTION
File-HStore is a very minimalist perl library to store files on a filesystem using a very simple hash-based storage.
File-HStore is nothing more than a simple wrapper interface to a storage containing a specific directory structure where files are hold based on their hashes. The name of the directories is based on the first two bytes of the hexadecimal form of the digest. The file is stored and named with its full hexadecimal form in the corresponding prefixed directory.
The current version is supporting the SHA-1 algorithm.
METHODS
The object oriented interface to File::HFile is described in this section.
The following methods are provided:
- $store = File::HStore->new($path)
-
This constructor returns a new
File::HFileobject encapsulating a specific store. The path specifies where the HStore is located on the filesystem. If the path is not specified, the path ~/.hstore is used. - $store->add($filename)
-
The $filename is the file to be added in the store. The return value is the hash value of the $filename stored. Return -1 on error.
- $store->remove($hashvalue)
-
The $hashvalue is the file to be removed from the store. Return value 0 on success and -1 on error.
SEE ALSO
There is a web page for the File::HStore module at the following location : http://www.foo.be/hstore/
If you plan to use a hash-based storage (like File::HStore), don't forget to read the following paper and check the impact for your application :
An Analysis of Compare-by-hash - http://www.usenix.org/events/hotos03/tech/full_papers/henson/henson.pdf
AUTHOR
Alexandre "adulau" Dulaunoy, <adulau@foo.be>
COPYRIGHT AND LICENSE
Copyright (C) 2004,2005 by Alexandre Dulaunoy <adulau@uucp.foo.be>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.5 or, at your option, any later version of Perl 5 you may have available.
2 POD Errors
The following errors were encountered while parsing the POD:
- Around line 144:
'=item' outside of any '=over'
- Around line 161:
You forgot a '=back' before '=head1'