File::Dir::Hash - Relieve the stress on your filesystem by making arbitrarily large trees to store otherwise non hierarchical data
File::Dir::Hash is a simple object and tries to be configurable to how you wish to index your directory.
File::Dir::Hash
Creates a new instance. It takes a hash of options. Valid keys are:
This is a coderef which will 'hash' your filenames/whatever. This doesn't have to return a hash or even anything other than the string itself. It is called with the input to "genpath". If ommited, will use md5_hex from Digest::MD5
This determines how the index will split the key. This is an arrayref of integers. The 'hash' is split as many times as there are elements in the array, with each split being the size of the value of that element.
Thus if the hash_func returns 'ABCEFGHIJKLMOPQRST' and the pattern is [1,2,5] then the resultant path would be A/BC/EFGHI/JKLMNOPQRST. The default pattern is [1,2,2,4]
hash_func
pattern
[1,2,5]
A/BC/EFGHI/JKLMNOPQRST
[1,2,2,4]
This is the base directory. Nothing to see here, move along.
Tries to generate a path based on arbitrary input in $key (passed to "hash_func") and optionally creates the path (but not the last component, assumed to be a filename), if $mkdir is set to true.
$key
$mkdir
Use this at your own risk. API and options might change.
Copyright 2011 M. Nunberg
To install File::Dir::Hash, copy and paste the appropriate command in to your terminal.
cpanm
cpanm File::Dir::Hash
CPAN shell
perl -MCPAN -e shell install File::Dir::Hash
For more information on module installation, please visit the detailed CPAN module installation guide.