NAME
Data::DigestPath - the path generator as digest hash
SYNOPSIS
use Data::DigestPath;
my $dp = Data::DigestPath->new;
my $path = $dp->make_path('foo'); # a/c/b/d/acbd18db4cc2f85cedef654fccc4a4d8
There are all options.
use Digest::SHA1 qw//;
use Data::DigestPath;
my $dp = Data::DigestPath->new(
salt => 'bar',
depth => 2,
delim => '-',
digest => sub { Digest::SHA1::sha1_hex(@_) },
);
warn $dp->make_path('baz'); # 3-2-32b1bf1853e6c39e4a1c3dae941ab7094ff1d293
DESCRIPTION
Data::DigestPath makes the path as digest hash.
METHODS
new(%options)
the object constructor
%options
salt => $string // ''
depth => $integer // 4
delim => $string // '/'
digest => $code_ref // sub { Digest::MD5::md5_hex(@_) }
trancate => $bool // undef
-
If you set the trancate param TRUE value, then the last delimited string will trancate(= remove the delimited path strings from last string)
use Data::DigestPath; my $dp = Data::DigestPath->new; warn $dp->make_path; # d/4/1/d/d41d8cd98f00b204e9800998ecf8427e $dp->trancate(1); warn $dp->make_path; # d/4/1/d/8cd98f00b204e9800998ecf8427e
make_path($key[, $length])
generate the path
REPOSITORY
Data::DigestPath is hosted on github <http://github.com/bayashi/Data-DigestPath>
Welcome your patches and issues :D
AUTHOR
Dai Okabayashi <bayashi@cpan.org>
LICENSE
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.