http://qs321.pair.com?node_id=1010230

samwyse has asked for the wisdom of the Perl Monks concerning the following question:

I need to access a variety of networking equipment and start a debug log on each, then wait for an event on another server, then re-access the networking equipment to stop the debug mode, and finally collect the logs for upload to an FTP site. I am using the threads module but the details of the requirements have reached the point where I feel that some sort of scheduler is required.

I have a precedence list, such as used in a topo sort, to determine which tasks need to wait for which other tasks to complete before they can run. In all but one case, each task needs to wait for all of it's preceding tasks to complete before it can execute, however tasks can and should be executed in parallel when ever possible. Every example that I have found for using the threads module starts all possible tasks at the same time and waits for them all to complete before proceeding. This is not what I need to do, I have a "skein" of tasks to be executed. (The one exception to the wait-for-all rule is that I have two tasks that need to wait for either of them to finish instead of both. One of the tasks is grepping a remote log file looking for a match, the other task is waiting for the remote machine to crash. If either task finishes, the other should be aborted and I can continue with the next step.)

Can anyone point me to a package or code that accomplishes what I need to do? Many thanks.