On Wed, May 05, 2004 at 11:00:38PM -0500, Eric Wilhelm wrote:
> Hi,
>
> I'm looking for a module which would operate similar to the following example.
> If anyone has suggestions or feedback, I'd like to hear them. (I'd really
> like to here "it's already been solved".)
I recently implemented something like this using an MD5 hash, suggested
by Randal Schwartz on perlmonks.org. It's perhaps too simple to make a
module for, though:
use Digest::MD5 (qw/md5_hex/);
my $id = '123446';
my $ext = 'jpg';
my $md5_path = md5_hex($id);
$md5_path =~ s|^(.)(.)(.).*|$1/$2/$3|;
my $final_path = "$md5_path/$id.$ext";
My example depends on each file having a unique ID, which your case
didn't. Perhaps you could use an MD5 of the file contents to generate
unique strings for them, though.
Mark
--
. . . . . . . . . . . . . . . . . . . . . . . . . . .
Mark Stosberg Principal Developer
[EMAIL PROTECTED] Summersault, LLC
765-939-9301 ext 202 database driven websites
. . . . . http://www.summersault.com/ . . . . . . . .