On Wed, 2003-12-17 at 17:15, david nicol wrote:
> As I understand it, the "standard" way to (de)marshall things anymore
> is to use Storable.  see DirDB::Storable for an example of a multi-level
> tie that punts anything other than scalars and unblessed hashrefs to
> Storable for nstorage and retreival.

This is yet another corollary to my solution. If you like Storable then:

use Storable qw(freeze thaw);
use Tie::HashWrapper;

tie my %wrappee, 'AnyDBM_File', ...;
tie my %hash, 'Tie::HashWrapper', \%wrappee,
        -inflate_value => sub { thaw(shift) },
        -deflate_value => sub { freeze(shift) };
$hash{a}{complicated}[4]{data} = [ 'structure' ];

> 
> If you're not going to have more than a thousand records (or you
> have reiserfs) DirDB might be the module for you rather than a
> single-file database.

Ah, Hubris, Randall Schwartz and the Great One would be proud. ;)

Alas, either I am being misunderstood or no one has an answer to my
questions. I believe I was asking for it with the subject line of
"Simple multi-level tie". What I should have wrote is "Wrapping hashes
with arbitrary inflate/deflate methods."

This is a tool that adds syntactic sugar to hashes. I developed it for
the purpose of making complicated storage in hashes tied to DBM files
nicer. It doesn't matter if you use CGI::query_string, Storable,
join/split, pack/unpack, or even just use this to do some kind of wacky
filtering, this tool isn't a marshalling tool, it is a syntax helper.

What I want to know is, is Tie::HashWrapper a good name? If you don't
like that name, what might you call it? HashWrapper sounds kind of dorky
to me, but that's what first came to mind and I didn't want to spend all
day trying to name it, I wanted to play code monkey.

Cheers,
Sterling

-- 
<>< ><> <>< ><> <>< ><> <>< ><> <>< ><> <>< ><> <>< ><> <>< ><> <>< ><>
  Andrew Sterling Hanenkamp
  http://Andrew.Sterling.Hanenkamp.com/
  [EMAIL PROTECTED] / [EMAIL PROTECTED]

  Microsoft is a cross between the Borg and the Ferengi.
  Unfortunately, they use Borg to do their marketing and Ferengi to
  do their programming.
                                       -- Simon Slavin

Reply via email to