line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#$Id: Storable.pm 97 2007-06-17 13:18:56Z zag $ |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package HTML::WebDAO::Store::Storable; |
4
|
1
|
|
|
1
|
|
2597
|
use Storable qw(lock_nstore lock_retrieve); |
|
1
|
|
|
|
|
3740
|
|
|
1
|
|
|
|
|
86
|
|
5
|
1
|
|
|
1
|
|
760
|
use HTML::WebDAO::Store::MLDBM; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use strict 'vars'; |
7
|
|
|
|
|
|
|
use base 'HTML::WebDAO::Store::MLDBM'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub load { |
10
|
|
|
|
|
|
|
my $self =shift; |
11
|
|
|
|
|
|
|
my $id = shift || return {}; |
12
|
|
|
|
|
|
|
my $db_file = $self->_dir()."sess_$id.sdb"; |
13
|
|
|
|
|
|
|
return {} unless -e $db_file; |
14
|
|
|
|
|
|
|
return lock_retrieve($db_file); |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub store { |
18
|
|
|
|
|
|
|
my $self =shift; |
19
|
|
|
|
|
|
|
my $id = shift || return {}; |
20
|
|
|
|
|
|
|
my $ref_tree = shift; |
21
|
|
|
|
|
|
|
return unless $ref_tree && ref($ref_tree); |
22
|
|
|
|
|
|
|
my $db_file = $self->_dir()."sess_$id.sdb"; |
23
|
|
|
|
|
|
|
lock_nstore($ref_tree,$db_file); |
24
|
|
|
|
|
|
|
return $id; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
1; |