Tie data hash to DBM file leaving massive cruft?by punch_card_don (Curate)
|on Mar 05, 2013 at 20:26 UTC||Need Help??|
punch_card_don has asked for the
wisdom of the Perl Monks concerning the following question:
For depressing-to-explain reasons, we're using an old DBM file (data_dbm_file) as a backup to a small sql database (data_db) of name/value pairs. Each time data_db is updated, the following sub routine is run:
And this is re-run every time there's a change to the data_db database. So, essentially, the DBM file gets completely re-written every time there's any change to the data_db database.
It seems to work just fine - the DBM file is checked on occasion and always mirrors the sql database.
BUT - there's always a but - if I ftp a copy of the data_dbm_file from the server onto my (Windows) PC, and open it in Notepad, among the long list of data I find this sort of thing:
Multiple entires with slight variations of old name/value pairs that were thought to be deleted long ago. There can be dozens of them for a single name. But they don't appear in a listing of the contents of the DBM file if we do:
This outputs just the expected name/value pairs.
What is all this extra cruft? Is this due to something about our re-writing sub-routine? Or a typical result in a DBM file? Or something else?
Time flies like an arrow. Fruit flies like a banana.