in reply to Perl::Tk - Event sequencing question
The answer also depends upon how this tarring of things gets started. Assuming you have a file-explorer type dialog, in which the user can chose a bunch of directories to tar up, and then hit a 'Go' button, I would do something like: Start a bunch of subprocesses asynchronuously, keeping track of their process IDs, and calling a fileevent with a callback on each. (The callback can be the same function, with parameters process ID and filename, or similar). The callback updates a dialog box showing a list of directories the user wanted to tar, showing which are finished.
If the user hits cancel, you can then kill any processes that arent finished yet, and delete any parts of files they may have created.
In effect, you then are doing a foreach loop, but not waiting for the results, just starting a process and ignoring it until it reports ready.
An alternative would be to go through the list of picked directory names, calling tar, waiting until finished, updating the dialog box (a checkbox or something), to say so, then going on to the next. Im not sure how a 'Cancel' would interrupt this one though, it would probably have to check another variable to see if the cancel button has been hit.
Its certainly nicer to keep a dialog window up, and update it with a status, than flash up new windows for each process, since in the end there will be a whole bunch of them, or if you wait for the user to click them away, you're wasting time, and they might not, in which case the process will wait forever.
Code would be useful, to see where you are trying to integrate this. And if my assumptions are anywhere near what you need.
C.
|
|---|