my $debug = 0;
+my $cleaned = 0;
+
sub open {
my $self = shift;
if ( ! -e $path ) {
mkdir $path || die "can't create $path: $!";
warn "created $path directory\n" if $debug;
- } elsif ( $args->{clean} ) {
+ } elsif ( $args->{clean} && ! $cleaned ) {
warn "removed old $path\n" if $debug;
foreach my $uid ( $self->all_uids ) {
my $file = $self->file( $uid );
unlink $file || die "can't remove $file: $!";
}
+ $cleaned++;
}
return;
}
+
+=head2 set_state
+
+ $store->set_state( $uid, $state );
+
+=cut
+
+sub set_state {
+ my ( $self, $uid, $state ) = @_;
+ my $file = $self->file( $uid );
+ return $self->save_hash( $file, $state );
+}
+
+
=head2 all_uids
my @uids = $store->all_uids;