1N/Apackage Memoize::Storable;
1N/A
1N/A=head1 NAME
1N/A
1N/AMemoize::Storable - store Memoized data in Storable database
1N/A
1N/A=head1 DESCRIPTION
1N/A
1N/ASee L<Memoize>.
1N/A
1N/A=cut
1N/A
1N/Ause Storable ();
1N/A$VERSION = 0.65;
1N/A$Verbose = 0;
1N/A
1N/Asub TIEHASH {
1N/A require Carp if $Verbose;
1N/A my $package = shift;
1N/A my $filename = shift;
1N/A my $truehash = (-e $filename) ? Storable::retrieve($filename) : {};
1N/A my %options;
1N/A print STDERR "Memoize::Storable::TIEHASH($filename, @_)\n" if $Verbose;
1N/A @options{@_} = ();
1N/A my $self =
1N/A {FILENAME => $filename,
1N/A H => $truehash,
1N/A OPTIONS => \%options
1N/A };
1N/A bless $self => $package;
1N/A}
1N/A
1N/Asub STORE {
1N/A require Carp if $Verbose;
1N/A my $self = shift;
1N/A print STDERR "Memoize::Storable::STORE(@_)\n" if $Verbose;
1N/A $self->{H}{$_[0]} = $_[1];
1N/A}
1N/A
1N/Asub FETCH {
1N/A require Carp if $Verbose;
1N/A my $self = shift;
1N/A print STDERR "Memoize::Storable::FETCH(@_)\n" if $Verbose;
1N/A $self->{H}{$_[0]};
1N/A}
1N/A
1N/Asub EXISTS {
1N/A require Carp if $Verbose;
1N/A my $self = shift;
1N/A print STDERR "Memoize::Storable::EXISTS(@_)\n" if $Verbose;
1N/A exists $self->{H}{$_[0]};
1N/A}
1N/A
1N/Asub DESTROY {
1N/A require Carp if $Verbose;
1N/A my $self= shift;
1N/A print STDERR "Memoize::Storable::DESTROY(@_)\n" if $Verbose;
1N/A if ($self->{OPTIONS}{'nstore'}) {
1N/A Storable::nstore($self->{H}, $self->{FILENAME});
1N/A } else {
1N/A Storable::store($self->{H}, $self->{FILENAME});
1N/A }
1N/A}
1N/A
1N/Asub FIRSTKEY {
1N/A 'Fake hash from Memoize::Storable';
1N/A}
1N/A
1N/Asub NEXTKEY {
1N/A undef;
1N/A}
1N/A1;