I have a Hash of Hashes created from a configuration file. In my program I first iterate over the hash to check for grammatical correctness as the rules in my program set forth. Upon finding incorrect rules in the has of configuration data I flag the hash entry for deletion. After this loop I delete the invalid entries from the hash.
Next I iterate over the hash again, this time checking that the rules that matched in grammer are correct in content. Things like files named in the config file exist, things named as directories are indeed directories etc. While doing this I again flag invalid entries to be deleted from the hash. When exiting this loop I delete the flagged entries from the hash.
Now I have a hash that contains rules checked for grammer and content. I can now iterate over the hash AGAIN and process the remaining rules.
Ok, here's the deal. Because I am in a loop in the lower level of the HoH I do not want to delete the hash entry until I am out of the processing loop, that's why I flag the entry then delete it afterward. What I would like opinions on is this:
Should I keep each of these functions as seperate functions and keep iterating over the hash each time I need to access the data or should I combine this into a single larger function and operate as follows?
Iterate over the hash and check grammer on each entry, if the grammer is correct, check for valid content in that particular entry. Once each 'rule' has been checked for grammer and validity process that rule ( I have defined actions for each rule type ). After processing the single rule, check the next rule for grammer and validity then process it, etc?
K, fire away, I can take it.
In reply to Request opinions and ideas by gnu@perl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |