Nice corollary, but this isn't really what Tie::HashWrapper addresses.
Tie::HashWrapper is a general utility that could be used by you to clean
up your code that was:

tie %tied, 'MyDBM', ...;
my $q = CGI->new($tied{key});
$q->param("x", "y");
$tied{key} = $q->query_string;

to

tie %wrappee, 'MyDBM', ...;
tie %tied, 'Tie::HashWrapper', \%wrappee,
        -deflate_value => sub { shift->query_string },
        -inflate_value => sub { CGI->new(shift)->Vars };

$tied{key}{x} = "y";

Regards,
Sterling

On Wed, 2003-12-17 at 14:12, Mark Stosberg wrote:
> On Wed, Dec 17, 2003 at 02:00:23PM -0600, Andrew Sterling Hanenkamp wrote:
> >         
> > 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:
> 
> When I want to do this, I just use CGI.pm. With it, you can pass a hash
> to the 'new' constructor, and use query_string() function (I think) to
> get back a stringified version. 
> 
> Likewise, you can pass a query-string to the constructor, and get a hash 
> structure back. Keys with multiple values are supported, although I
> usually don't have that case.
> 
> Your solution may well be cleaner for general cases.
> 
>       Mark
-- 
<>< ><> <>< ><> <>< ><> <>< ><> <>< ><> <>< ><> <>< ><> <>< ><> <>< ><>
  Andrew Sterling Hanenkamp
  http://Andrew.Sterling.Hanenkamp.com/
  [EMAIL PROTECTED] / [EMAIL PROTECTED]

  C makes it easy for you to shoot yourself in the foot.  C++ makes
  that harder, but when you do, it blows away your whole leg.
                                         -- Bjarne Stroustrup

Reply via email to