```{index} single: recover (GDBM_File) ``` ```{index} single: GDBM_File::recover ``` # recover Recover a damaged database. pperl's files are never left damaged, so recovery finds every key intact; it still makes the backup copy and fills in the statistics asked for. ## Synopsis ```perl my ($backup, %stat); $db->recover(backup => \$backup, stat => \%stat); ``` ## Options - `backup => \$name` - copy the file first, to `NAME.~N~` with the first free number `N`, and put that name in `$name`. - `stat => \%stat` - fill in `recovered_keys` (every key), `recovered_buckets`, `failed_keys` and `failed_buckets` (both 0). - `err => sub {...}`, `max_failed_keys`, `max_failed_buckets`, `max_failures` - accepted; with nothing failing they never matter. ## What you get back Nothing; a failure (the backup copy cannot be made) croaks. An unknown option croaks `NAME: unrecognized argument`, and an odd number of arguments with a usage message. ## Differences from upstream gdbm rebuilds a damaged file and reports what it lost; pperl's file has nothing to rebuild. Covered by `t/81-xs-native/GDBM_File/010-phenotype.t`. ## See also - `needs_recovery` - always 0