17 |
|
|
18 |
=head2 open |
=head2 open |
19 |
|
|
20 |
|
$store->open({ |
21 |
|
path => 'var/', |
22 |
|
debug => 1, |
23 |
|
clean => 1, |
24 |
|
}); |
25 |
|
|
26 |
=cut |
=cut |
27 |
|
|
28 |
my $path; |
my $path; |
29 |
|
|
30 |
my $debug = 1; |
my $debug = 0; |
31 |
|
|
32 |
sub open { |
sub open { |
33 |
my $self = shift; |
my $self = shift; |
43 |
|
|
44 |
if ( ! -e $path ) { |
if ( ! -e $path ) { |
45 |
mkdir $path || die "can't create $path: $!"; |
mkdir $path || die "can't create $path: $!"; |
46 |
warn "created $path directory\n"; |
warn "created $path directory\n" if $debug; |
47 |
|
} elsif ( $args->{clean} ) { |
48 |
|
warn "removed old $path\n" if $debug; |
49 |
|
foreach my $uid ( $self->all_uids ) { |
50 |
|
my $file = "$path/$uid.yml"; |
51 |
|
unlink $file || die "can't remove $file: $!"; |
52 |
|
} |
53 |
} |
} |
54 |
|
|
55 |
|
|
56 |
} |
} |
57 |
|
|
58 |
=head2 update_uid_state |
=head2 update_uid_state |