I actually like names that sound like food<g!> On a slightly more serious
note---If I were looking for stringification, I wouldn't be looking under
HashWrapper. Perhaps Tie::HashStringify or the like?

--hsm

> -----Original Message-----
> From: Andrew Sterling Hanenkamp [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, December 17, 2003 1:00 PM
> To: Module Authors
> Subject: Simple multi-level tie
>
>
> I would like the ability to store a complicated record inside of a DBM
> file. I looked in the usual places and perldoc -q DBM gives me:
>
>         Either stringify the structure yourself (no fun), or else get
>         the MLDBM (which uses Data::Dumper) module from CPAN and layer
>         it on top of either DB_File or GDBM_File.
>
> Therefore, I went in search of a solution to automate the
> stringification. I didn't find anything other than MLDBM for doing
> something like this and it seems like a little much for my purposes. All
> I need is something like this:
>
> $hash{name} = "value1:value2:value3:...";
>
> I've done some work with Tie::Memoize and really like it's interface, so
> I decided to write something like it for wrapping hashes. Thus,
> Tie::HashWrapper was born. It may be used like this:
>
> tie my %wrappee, 'AnyDBM_File', ...;
> tie my %wrapper, 'Tie::HashWrapper', \%wrappee,
>       -deflate_value => sub { join ':', @{$_[0]} },
>       -inflate_value => sub { split /:/, $_[0] };
>
> $wrapper{name} = [ value1, value2, value3 ];
>
> and so forth. In addition, if one wants to have more complicated keys,
> one may add -deflate_key/-inflate_key values to the call to tie. I
> haven't uploaded it CPAN yet pending documentation and finding a good
> name.
>
> Does Tie::HashWrapper seem reasonable? Or does anyone have a better
> name? Have I gone off the deep-end again and rewritten something that
> already exists and I missed it?
>
> Cheers,
> Sterling
>
> --
> <>< ><> <>< ><> <>< ><> <>< ><> <>< ><> <>< ><> <>< ><> <>< ><> <>< ><>
>   Andrew Sterling Hanenkamp
>   http://Andrew.Sterling.Hanenkamp.com/
>   [EMAIL PROTECTED] / [EMAIL PROTECTED]
>
>   There exists in the human heart a depraved taste for equality, which
>   impels the weak to attempt to lower the powerful to their own level,
>   and reduces men to prefer equality in slavery to inequality under
>   freedom.                 -- Alexis de Tocqueville
>

Reply via email to