[Israel.pm] tie

Itamar Elem elem at compugen.co.il
Tue Jun 15 08:01:53 PDT 2004

you can implement tiearray package

i try to sketch its FETCH and STORE subs

use Storable;
use some of the memzip modules;
use DBM_File;

tie %h,'DBM_FILE',....;

  my ($self,$index,$value)=@_; 

 my $packed_value = compress freeze $value;

  $h{$index} = $packed_value;


  my ($self,$index)=@_; 

  return thaw uncompress $h{$index};


now in your main 

use the module

tie @v to the module


-----Original Message-----
From: Shlomo Yona [mailto:shlomo at cs.haifa.ac.il]
Sent: Tuesday, June 15, 2004 5:47 PM
To: Perl in Israel
Subject: RE: [Israel.pm] tie

On Tue, 15 Jun 2004, Itamar Elem wrote:

> hi shlomo
> i think you can do something like the mldbm does
> when you assign value to one of the toplevel array cells
> you packed the value with storable and mabye with compress something like  compress freeze $value (inside the tie package )
> and when you fetch the value in the tie package you do the opposite  thaw uncompress  $value

I'll be honest and say I didn't understand how this can be
done. Can you please explain again, perhaps using some


Shlomo Yona
shlomo at cs.haifa.ac.il
Perl mailing list
Perl at perl.org.il

More information about the Perl mailing list