line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::locket::Store; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
81675
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
32
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
28
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
693
|
use Any::Moose; |
|
1
|
|
|
|
|
33468
|
|
|
1
|
|
|
|
|
6
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
has store => qw/ is ro required 1 isa HashRef /; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub from { |
11
|
2
|
|
|
2
|
0
|
12836
|
return shift->new( store => shift ); |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub search { |
15
|
7
|
|
|
7
|
0
|
11066
|
my $self = shift; |
16
|
7
|
|
|
|
|
11
|
my $query = shift; |
17
|
|
|
|
|
|
|
|
18
|
7
|
|
|
|
|
9
|
my @source = sort keys %{ $self->store }; |
|
7
|
|
|
|
|
47
|
|
19
|
7
|
|
|
|
|
11
|
my @found; |
20
|
7
|
|
|
|
|
8
|
my $last_found = 0; |
21
|
7
|
|
|
|
|
10
|
my @clean_query; |
22
|
7
|
|
|
|
|
12
|
for my $target ( @$query ) { |
23
|
14
|
|
|
|
|
21
|
@found = sort grep { m/\Q$target\E/ } @source; |
|
59
|
|
|
|
|
218
|
|
24
|
14
|
100
|
|
|
|
31
|
if ( @found != $last_found ) { |
25
|
13
|
|
|
|
|
17
|
push @clean_query, $target; |
26
|
13
|
|
|
|
|
14
|
$last_found = @found; |
27
|
|
|
|
|
|
|
} |
28
|
14
|
100
|
|
|
|
30
|
if ( @found ) { |
29
|
9
|
|
|
|
|
22
|
@source = @found; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
else { |
32
|
5
|
|
|
|
|
9
|
last; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
return { |
37
|
7
|
|
|
|
|
39
|
query => \@clean_query, |
38
|
|
|
|
|
|
|
found => \@found, |
39
|
|
|
|
|
|
|
}; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub all { |
43
|
2
|
|
|
2
|
0
|
1309
|
my $self = shift; |
44
|
2
|
|
|
|
|
3
|
my @result = sort keys %{ $self->store }; |
|
2
|
|
|
|
|
15
|
|
45
|
2
|
|
|
|
|
14
|
return @result; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub get { |
49
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
50
|
0
|
|
|
|
|
|
my $key = shift; |
51
|
0
|
|
|
|
|
|
return $self->store->{ $key }; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
1; |