Based on your description of what is happening, DB_File
really thinks that the file is empty. There are many ways in which this could have happened, including your having the wrong file, the person who created it having messed up, the result of a software conflict between the old and the current version of BerkeleyDB, the person who created it didn't have what you think was on the machine so
dbmopen fell back (through
AnyDBM_File) to a different dbm implementation than you think it did, the file that you think you're loading is not in the location that you're opening, etc, etc, etc. I have no way to know which of these is happening. I can only tell you that as far as
dbmopen is concerned, you don't have data in the file being opened.
As for using tie, it is a small change. Change the dbmopen line to:
use DB_File;
tie %TEST, 'DB_File', '/home/lab/access.db';
and if there is a
dbmclose line, just call
untie.
The change is tiny. The advantage is that you guarantee that you aren't creating with one dbm and then trying to read with another later. If what you've said is correct, though, it likely won't help you. But you should try to use tie and try out each of NDBM_File, SDBM_File and ODBM_file to see if it is in one of those formats. (Type perldoc X to see if X is installed and to find out how to try using it.)
If all else fails, then chalk this up to lessons learned - always have a plaintext backup that you can restore critical data from.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.