/usr/share/perl5/Spoon/IndexList.pm is in libspoon-perl 0.24-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | package Spoon::IndexList;
use Spiffy -selfless;
use IO::All;
use DB_File;
sub index_list {
my $list = io(shift);
my $index = io($list . '.db')->dbm('DB_File')->rdonly;
unless ($index->exists) {
$index->assert->open;
$index->close;
}
unless ($list->exists) {
my $mtime = $index->mtime;
$list->print('');
for (sort keys %$index) {
$list->print("$_\n");
}
$index->close;
$list->close;
$list->utime($mtime - 1);
}
if ($list->mtime > $index->mtime) {
my %copy = %$index;
$index->close;
$index->rdonly(0)->rdwr(1)->open;
for my $key ($list->chomp->slurp) {
$key =~ s/^\s*(.*?)\s*$/$1/;
next unless $key;
$index->{$key} = 1;
delete $copy{$key};
}
for my $key (keys %copy) {
delete $index->{$key};
}
$index->rdonly(1)->rdwr(0)->close;
}
return $index;
}
|