sub getMem { my $self = shift; my $confID = shift; $confID = $self->{_itm6_lib_gen}->{_CONFID} unless defined $confID; my $mem = {}; # default to an empty one my $local_store = "local_$confID.memstore"; if (-e $local_store) { eval { $mem = lock_retrieve $local_store }; if ($@) { $self->{_logger}->trace( 1, "getMem: Reading store failed: $@"); print "getMem: Reading store failed: $@\n"; } } else { # print "$local_store not found\n"; } push @{ $self->{_file_to_write} }, [$mem, $local_store]; # note we need to write this return $mem; } # Saving is done in DESTROY sub DESTROY { my $self = shift; for (@{ $self->{_file_to_write} }) { my ($mem, $store) = @$_; lock_store ($mem, $store); } }