# tie new maint/source maint indexes for forward and reverse
for my $idx (keys %{$indexes}) {
for my $fr ('','_reverse') {
- tie %{$indexes->{$idx}{"tie$fr"}},
- MLDBM => $indexes->{$idx}{"index$fr"}.'-new',
- O_CREAT|O_TRUNC|O_RDWR, 0644 or
- die qq(Unable to tie $indexes->{$idx}{"index$fr"}-new: $!);
+ $indexes->{$idx}{"tie$fr"} =
+ create_index_file($indexes->{$idx}{"index$fr"}.'-new');
}
}
for my $idx (keys %{$indexes}) {
}
}
+sub create_index_file {
+ my ($idx_fn) = @_;
+ my $idx = {};
+ tie %{$idx},
+ MLDBM => $idx_fn,
+ O_CREAT|O_TRUNC|O_RDWR, 0644 or
+ die qq(Unable to tie $idx_fn: $!);
+ return $idx;
+}
+
sub add_to_index {
my ($fn,$forward,$reverse,$type) = @_;