line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Dist::Surveyor::DB_File; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
37
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
85
|
|
4
|
3
|
|
|
3
|
|
15
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
89
|
|
5
|
3
|
|
|
3
|
|
1716
|
use Storable qw(freeze thaw); |
|
3
|
|
|
|
|
9341
|
|
|
3
|
|
|
|
|
626
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.021'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our @ISA; |
10
|
|
|
|
|
|
|
if (eval { require DB_File; 1; }) { |
11
|
|
|
|
|
|
|
@ISA = ('DB_File'); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
elsif (eval { require SDBM_File; 1; }) { |
15
|
|
|
|
|
|
|
@ISA = ('SDBM_File'); |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
else { |
18
|
|
|
|
|
|
|
die "Need either DB_file or SDBM_File installed to run"; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# DB_File can store only strings as values, and not Perl structures |
22
|
|
|
|
|
|
|
# this small wrapper fixes the problem |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub STORE { |
25
|
0
|
|
|
0
|
|
|
my ($self, $key, $val) = @_; |
26
|
0
|
|
|
|
|
|
$self->SUPER::STORE($key, freeze($val)); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub FETCH { |
30
|
0
|
|
|
0
|
|
|
my ($self, $key) = @_; |
31
|
0
|
|
|
|
|
|
my $val = $self->SUPER::FETCH($key); |
32
|
0
|
|
|
|
|
|
return thaw($val); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
return 1; |