line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
####################################################################
|
2
|
|
|
|
|
|
|
package MLDBM::Serializer::Storable;
|
3
|
1
|
|
|
1
|
|
43
|
BEGIN { @MLDBM::Serializer::Storable::ISA = qw(MLDBM::Serializer) }
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
6
|
use Storable;
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
274
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub new {
|
8
|
2
|
|
|
2
|
0
|
12
|
my $self = shift->SUPER::new();
|
9
|
2
|
|
|
|
|
7
|
$self->DumpMeth(shift);
|
10
|
|
|
|
|
|
|
# Storable doesn't honor other attributes
|
11
|
2
|
|
|
|
|
5
|
$self;
|
12
|
|
|
|
|
|
|
}
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
#
|
15
|
|
|
|
|
|
|
# Serialize a reference to supplied value
|
16
|
|
|
|
|
|
|
#
|
17
|
|
|
|
|
|
|
sub serialize {
|
18
|
13
|
|
|
13
|
0
|
24
|
my $self = shift;
|
19
|
13
|
|
|
|
|
20
|
my $dumpmeth = $self->{'_dumpsub_'};
|
20
|
13
|
|
|
|
|
40
|
&$dumpmeth(\$_[0]);
|
21
|
|
|
|
|
|
|
}
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
#
|
24
|
|
|
|
|
|
|
# Deserialize and de-reference
|
25
|
|
|
|
|
|
|
#
|
26
|
|
|
|
|
|
|
sub deserialize {
|
27
|
13
|
|
|
13
|
0
|
64
|
my $obj = Storable::thaw($_[1]); # Does not care whether portable
|
28
|
13
|
50
|
|
|
|
261
|
defined($obj) ? $$obj : undef;
|
29
|
|
|
|
|
|
|
}
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
#
|
32
|
|
|
|
|
|
|
# Change dump method when portability is requested
|
33
|
|
|
|
|
|
|
#
|
34
|
|
|
|
|
|
|
sub DumpMeth {
|
35
|
3
|
|
|
3
|
0
|
5
|
my $self = shift;
|
36
|
3
|
100
|
66
|
|
|
26
|
$self->{'_dumpsub_'} =
|
37
|
|
|
|
|
|
|
($_[0] && $_[0] eq 'portable' ? \&Storable::nfreeze : \&Storable::freeze);
|
38
|
3
|
|
|
|
|
14
|
$self->_attrib('dumpmeth', @_);
|
39
|
|
|
|
|
|
|
}
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1;
|