Think about Loose Coupling | |
PerlMonks |
Re^4: Is this DBM::Deep behavior, or something with tie/bless? (normal)by romandas (Pilgrim) |
on Feb 06, 2008 at 12:38 UTC ( [id://666538]=note: print w/replies, xml ) | Need Help?? |
The reason for 'untie'ing the array is related to my program using Data::Compare to compare data structures. The DBM::Deep database stores a hash of arrays (which have a hash as an element, etc). When my program runs, it retrieves the old info from the database to compare it with the new live information. However, Data::Compare fails when comparing the two arrays (old and new info) because the old array is tied to the DBM, effectively comparing data structures that aren't alike (my logical/mental representation notwithstanding) since DBM::Deep hashes and arrays are objects, I think, as opposed to the regular hash/array structure of the new information in memory. The two solutions I thought of (assigning the database array to a temp variable; assigning the new information to a temp spot in the database) both do not work (for differing values of 'do not work') due to the variables getting tied to the database. I could potentially write a plugin for Data::Compare to handle this, but from what I can see that is way beyond my current ability. I would post my code, but haven't finished writing it yet. :) The "variable reuse" problem (I believe) is just an artifact of my test code above; I don't think it'll exist in my actual code.
In Section
Seekers of Perl Wisdom
|
|