1 # Dobrica Pavlinusic, <dpavlin@rot13.org> 10/26/07 21:37:12 CEST
2 package CWMP::Store::DBMDeep;
8 use Data::Dump qw/dump/;
13 CWMP::Store::DBMDeep - use DBM::Deep as storage
36 $debug = $args->{debug};
37 my $path = $args->{path} || confess "no path?";
39 warn "open ",dump( $args ) if $debug;
41 $path = "$path/state.db" if ( -d $args->{path} );
43 if ( $args->{clean} && -e $path ) {
44 warn "removed old $path\n";
45 unlink $path || die "can't remove $path: $!";
52 ) || confess "can't open $path: $!";
56 =head2 update_uid_state
58 $store->update_uid_state( $uid, $state );
62 sub update_uid_state {
63 my ( $self, $uid, $state ) = @_;
65 if ( my $o = $db->get( $uid ) ) {
66 warn "## update state of $uid\n" if $debug;
67 return $o->import( $state );
69 warn "## create new state for $uid\n" if $debug;
70 return $db->put( $uid => $state );
76 $store->get_state( $uid );
81 my ( $self, $uid ) = @_;
83 if ( my $state = $db->get( $uid ) ) {
84 return $state->export;
92 my @uids = $store->all_uids;