1 # Dobrica Pavlinusic, <dpavlin@rot13.org> 10/26/07 21:37:12 CEST
2 package CWMP::Store::DBMDeep;
8 use Data::Dump qw/dump/;
14 CWMP::Store::DBMDeep - use DBM::Deep as storage
37 $debug = $args->{debug};
38 my $path = $args->{path} || confess "no path?";
40 warn "open ",dump( $args ) if $debug;
42 $path = "$path/state.db" if ( -d $args->{path} );
44 if ( $args->{clean} && -e $path ) {
45 warn "removed old $path\n";
46 unlink $path || die "can't remove $path: $!";
53 ) || confess "can't open $path: $!";
57 =head2 update_uid_state
59 $store->update_uid_state( $uid, $state );
63 sub update_uid_state {
64 my ( $self, $uid, $state ) = @_;
66 my $data = clone( $state );
68 if ( my $o = $db->get( $uid ) ) {
69 warn "## update state of $uid\n" if $debug;
72 warn "## create new state for $uid\n" if $debug;
73 $db->put( $uid => $data );
79 $store->get_state( $uid );
84 my ( $self, $uid ) = @_;
86 if ( my $state = $db->get( $uid ) ) {
93 my @uids = $store->all_uids;