Thank you for the reply. So, is there any way to retain the iterator position? Or, should I always copy the hash into another hash and then call the subroutine? | [reply] |
| [reply] [d/l] |
This is what I did to solve the problem. Firstly, I took all the keys in the hash and pushed them into an array defined using AV*. Then, I iterated over this array by popping the topmost element during every loop iteration. In parallel, I updated the hash with the results and executed the callback function too.
Using the array instead of keys ensured that the iterator does not get reset. Also, the array would be empty when I exit the function.
Thank you Tye for pointing out the mistake that I had done in the program.
| [reply] |
Completely agree with you. But, my XS function is going to run for long time (sometimes more than a day). At this point of time, I will be calling the Storable::store() in the callback routine to save the intermediate status. This will help me in checking the progress, whenever I need to. Would be happy to know if you have any better solution for this.
| [reply] |