re-enable all_parameteres collection of first connect
[perl-cwmp.git] / lib / CWMP / Store / HASH.pm
index bcc503d..5b15fcc 100644 (file)
@@ -32,6 +32,8 @@ my $path;
 
 my $debug = 0;
 
+my $cleaned = 0;
+
 sub open {
        my $self = shift;
 
@@ -47,12 +49,13 @@ sub open {
        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++;
        }
 
 
@@ -98,6 +101,20 @@ sub get_state {
        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;