|Perl Monk, Perl Meditation|
Pause and Resume Exeby gautamparimoo (Beadle)
|on Feb 27, 2013 at 11:24 UTC||Need Help??|
gautamparimoo has asked for the
wisdom of the Perl Monks concerning the following question:
I have a perl executable which recurses a filesystem using File::Find now I want to implement a pause and resume functionality such that the exe pauses in current state(or preserves current position) is some key is pressed or some other exe tells it to pause and then resume when key is pressed again or other exe tells to resume:
I thought of two approaches: 1.Remember the current file being recursed in a output file . Now this output file will give the last file traversed if we stop the program and restart it . But I cannot recurse from that file (I can skip all file till that file but that would take a lot of time and would not really be like a pause)to resume the recursion.
2. Maintain a second exe which calls some function to pause the state of the main exe and then resume again through the second exe. But how can I do it?? Please help??
Now I was having a look at Win32::Process and tried the following code ::
The above code is Script A and CC4.4.pl is Script B. Questions: $ProcessObj->Suspend() is given at the time of execution how do i arbitarily invoke it at any time? As the script A is running so I cannot tell it to suspend at runtime?