On Thu, 2003-12-18 at 04:26, Tim Bunce wrote: > I'd add a -1 to the split and not in the docs that the example > won't handle undefs.
Fine. The example is relatively close to what I need the package for, but as a general example it's probably a poor one. > I didn't like it at first but the more I try to think of alternatives, > and understand the purpose and use, the more I like it. > > A key point is that although it was created for inflating/deflating > values, there's no need to use it for that. It does 'wrap' access to > the underlying hash and that wrapping can be used for other purposes, > including logging or recording where/how the hash is used. Yes, I believe I mistated the utility of the module in my original post. I should have been more careful to state this possiblity up front. > > It's similar in some ways to: > http://search.cpan.org/~pmqs/BerkeleyDB-0.25/BerkeleyDB.pod#DBM_Filters > > And I think it would be worth making it more similar. Consider > > tie my %wrapper, 'Tie::HashWrapper', \%wrappee, > store_key => sub { lc(shift) }, > store_value => sub { join ':', @{$_[0]} }, > fetch_value => sub { lc(shift) }, > fetch_key => sub { split /:/, $_[0], -1 }; > > Tim. > > p.s. I trust your tests cover things like FIRSTKEY, NEXTKEY, DELETE etc. Well, the tests are hardly written as of now. They cover all tied hash operations, but very poorly. I plan on writing more robust tests before releasing it. Regards, Sterling -- <>< ><> <>< ><> <>< ><> <>< ><> <>< ><> <>< ><> <>< ><> <>< ><> <>< ><> Andrew Sterling Hanenkamp http://Andrew.Sterling.Hanenkamp.com/ [EMAIL PROTECTED] / [EMAIL PROTECTED] Keep me informed on the behaviour of this kernel.. As the "BugFree(tm)" series didn't turn out too well, I'm starting a new series called the "ItWorksForMe(tm)" series, of which this new kernel is yet another shining example. -- Linus, in the announcement for 1.3.29