[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',....;
sub STORE
{
my ($self,$index,$value)=@_;
my $packed_value = compress freeze $value;
$h{$index} = $packed_value;
}
sub FETCH
{
my ($self,$index)=@_;
return thaw uncompress $h{$index};
}
now in your main
use the module
tie @v to the module
$v[0][0]=1;
-----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
example?
Thanks.
--
Shlomo Yona
shlomo at cs.haifa.ac.il
http://cs.haifa.ac.il/~shlomo/
_______________________________________________
Perl mailing list
Perl at perl.org.il
http://perl.org.il/mailman/listinfo/perl
More information about the Perl
mailing list