move lock files to local
[spider.git] / perl / DXDupe.pm
index 4cc2be6ff936fccb7fb6693b642daade97b7ca19..3ccb23c89dd22df1b21369691cd2cf4950f8caf8 100644 (file)
@@ -27,7 +27,14 @@ $main::branch += $BRANCH;
 
 sub init
 {
-       $dbm = tie (%d, 'DB_File', $fn) or confess "can't open dupe file: $fn ($!)";
+       $dbm = tie (%d, 'DB_File', $fn);
+       unless ($dbm) {
+               eval { untie %d };
+               dbg("Dupefile $fn corrupted, removing...");
+               unlink $fn;
+               $dbm = tie (%d, 'DB_File', $fn) or confess "can't open dupe file: $fn ($!)";
+               confess "cannot open $fn $!" unless $dbm; 
+       }
 }
 
 sub finish