Mark Nunberg > File-Dir-Hash > File::Dir::Hash

Download:
File-Dir-Hash-0.02.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.02   Source  

NAME ^

File::Dir::Hash - Relieve the stress on your filesystem by making arbitrarily large trees to store otherwise non hierarchical data

DESCRIPTION ^

File::Dir::Hash is a simple object and tries to be configurable to how you wish to index your directory.

METHODS

new(%opts)

Creates a new instance. It takes a hash of options. Valid keys are:

hash_func

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

pattern

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]

basedir

This is the base directory. Nothing to see here, move along.

genpath($key,$mkdir)

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.

BUGS/CAVEATS/NOTES ^

Use this at your own risk. API and options might change.

AUTHOR AND COPYRIGHT ^

Copyright 2011 M. Nunberg

syntax highlighting: