line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Spoon::IndexList; |
2
|
1
|
|
|
1
|
|
1773
|
use Spiffy -selfless; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
9
|
|
3
|
1
|
|
|
1
|
|
636
|
use IO::All; |
|
1
|
|
|
1
|
|
2
|
|
|
1
|
|
|
1
|
|
48
|
|
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
32
|
|
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
12
|
|
4
|
1
|
|
|
1
|
|
584
|
use DB_File; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub index_list { |
7
|
|
|
|
|
|
|
my $list = io(shift); |
8
|
|
|
|
|
|
|
my $index = io($list . '.db')->dbm('DB_File')->rdonly; |
9
|
|
|
|
|
|
|
unless ($index->exists) { |
10
|
|
|
|
|
|
|
$index->assert->open; |
11
|
|
|
|
|
|
|
$index->close; |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
unless ($list->exists) { |
14
|
|
|
|
|
|
|
my $mtime = $index->mtime; |
15
|
|
|
|
|
|
|
$list->print(''); |
16
|
|
|
|
|
|
|
for (sort keys %$index) { |
17
|
|
|
|
|
|
|
$list->print("$_\n"); |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
$index->close; |
20
|
|
|
|
|
|
|
$list->close; |
21
|
|
|
|
|
|
|
$list->utime($mtime - 1); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
if ($list->mtime > $index->mtime) { |
24
|
|
|
|
|
|
|
my %copy = %$index; |
25
|
|
|
|
|
|
|
$index->close; |
26
|
|
|
|
|
|
|
$index->rdonly(0)->rdwr(1)->open; |
27
|
|
|
|
|
|
|
for my $key ($list->chomp->slurp) { |
28
|
|
|
|
|
|
|
$key =~ s/^\s*(.*?)\s*$/$1/; |
29
|
|
|
|
|
|
|
next unless $key; |
30
|
|
|
|
|
|
|
$index->{$key} = 1; |
31
|
|
|
|
|
|
|
delete $copy{$key}; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
for my $key (keys %copy) { |
34
|
|
|
|
|
|
|
delete $index->{$key}; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
$index->rdonly(1)->rdwr(0)->close; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
return $index; |
39
|
|
|
|
|
|
|
} |