line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Wikibase::Cache::Backend::Basic; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
375722
|
use base qw(Wikibase::Cache::Backend); |
|
5
|
|
|
|
|
70
|
|
|
5
|
|
|
|
|
2613
|
|
4
|
5
|
|
|
5
|
|
49878
|
use strict; |
|
5
|
|
|
|
|
13
|
|
|
5
|
|
|
|
|
144
|
|
5
|
5
|
|
|
5
|
|
25
|
use warnings; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
130
|
|
6
|
|
|
|
|
|
|
|
7
|
5
|
|
|
5
|
|
26
|
use Class::Utils qw(set_params); |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
176
|
|
8
|
5
|
|
|
5
|
|
31
|
use Error::Pure qw(err); |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
137
|
|
9
|
5
|
|
|
5
|
|
2292
|
use Text::DSV; |
|
5
|
|
|
|
|
2644
|
|
|
5
|
|
|
|
|
1514
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = 0.03; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub new { |
14
|
3
|
|
|
3
|
0
|
263
|
my ($class, @params) = @_; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# Create object. |
17
|
3
|
|
|
|
|
13
|
my $self = bless {}, $class; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# Process parameters. |
20
|
3
|
|
|
|
|
16
|
set_params($self, @params); |
21
|
|
|
|
|
|
|
|
22
|
3
|
|
|
|
|
45
|
$self->_load_data; |
23
|
|
|
|
|
|
|
|
24
|
3
|
|
|
|
|
13
|
return $self; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub _get { |
28
|
3
|
|
|
3
|
|
1491
|
my ($self, $type, $key) = @_; |
29
|
|
|
|
|
|
|
|
30
|
3
|
100
|
|
|
|
9
|
if (exists $self->{static}->{$key}) { |
31
|
2
|
50
|
|
|
|
6
|
if (exists $self->{static}->{$key}->{$type}) { |
32
|
2
|
|
|
|
|
37
|
return $self->{static}->{$key}->{$type}; |
33
|
|
|
|
|
|
|
} else { |
34
|
0
|
|
|
|
|
0
|
return; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
} else { |
37
|
1
|
|
|
|
|
4
|
return; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub _load_data { |
42
|
3
|
|
|
3
|
|
6
|
my $self = shift; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
# Read data. |
45
|
3
|
|
|
|
|
6
|
my $kramerius_data; |
46
|
3
|
|
|
|
|
14
|
my $dsv = Text::DSV->new; |
47
|
3
|
|
|
|
|
45
|
while (my $data = ) { |
48
|
156
|
|
|
|
|
245
|
chomp $data; |
49
|
156
|
|
|
|
|
306
|
my ($qid, $label, $description) = $dsv->parse_line($data); |
50
|
156
|
|
|
|
|
2933
|
$self->{'static'}->{$qid}->{'label'} = $label; |
51
|
156
|
|
|
|
|
575
|
$self->{'static'}->{$qid}->{'description'} = $description; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
3
|
|
|
|
|
25
|
return; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub _save { |
58
|
1
|
|
|
1
|
|
61
|
my ($self, $type, $key, $value) = @_; |
59
|
|
|
|
|
|
|
|
60
|
1
|
|
|
|
|
5
|
err __PACKAGE__." doesn't implement save() method."; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
1; |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
__DATA__ |