jhuijsing has asked for the wisdom of the Perl Monks concerning the following question:
I recently came a across a problem with an application that was saving configuration data as a hash in a file and using eval to load the data back. The problem was someone had created new entries by hand and had created duplicate keys. When I was running the code through the debugger, I could see that some keys were not being loaded into the hash, the duplicates were there. But I was missing some others.
I have 2 questions
My question is there some way of catching this error?
Can someone explain what was happening internally, that some hash entries where dropped?
its using Data::Dumper to save the hash and when it restore the data it slurps the file into a string and then executes %hash = eval $line
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: eval question
by choroba (Cardinal) on Jun 30, 2011 at 21:35 UTC | |
|
Re: eval question
by muba (Priest) on Jul 01, 2011 at 01:15 UTC | |
|
Re: eval question
by GrandFather (Saint) on Jul 02, 2011 at 01:34 UTC |