Okay, so I ended up having more time last night than I thought I would. I finished Tie::Filter and the filter packages for scalars, arrays, and hashes. I've decided to hold off on writing one for handles as it is a significantly more complicated problem--and it might be better as an IO:: class.
Anyway, the dist is named Tie-Filter-1.02 and it's been indexed at http://search.cpan.org/~hanenkamp/Tie-Filter-1.02/ so feel free to take a look at make suggestions. Regards, Sterling On Wed, 2003-12-17 at 14:00, Andrew Sterling Hanenkamp wrote: > 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] Myth: Linux has a lower TCO Fact: If you consider that buying NT licenses for business use is tax-deductible, as are all those tech support calls, NT actually has a lower TCO than Linux! How are you going to expense software that doesn't cost anything? Eh?!? -- From a LinuxToday post
