more useful options | |
PerlMonks |
Re^2: Using Perl to run a Windows command-line utility many times with ordered, parallel executionby Jim (Curate) |
on Feb 02, 2014 at 01:28 UTC ( [id://1073011]=note: print w/replies, xml ) | Need Help?? |
Thank you, ambrus. This is precisely the example I needed to help me get started. It wasn't clear enough from my original post that my problem isn't just that I don't understand how to do Windows process control using Perl. My problem is that I don't understand process control well at all. And when I read about it in documentation—not just Perl documentation, any documentation—my head explodes. I struggle with the unfamiliar lingo. If there's a good tutorial for absolute beginners, I haven't found it yet. But with the help of your straightforward Perl code snippet, I was able to make a good start. So here's the script I cobbled together based on your example. It has extra junk in it that's only there for self-educational purposes. Also, there are actually thousand of lines of DATA (i.e., external commands to be run), not just these few.
Until I implemented this, ran it, and watched it closely in action, I couldn't figure out either system() or waitpid(). I don't grok them, but I more-or-less understand what they're accomplishing. It's still unclear to me what the first argument of system(), 1, is for, and I also don't understand what the second argument of waitpid(), 0, is intended to do. An explanation of these mysterious arguments would be helpful. What are examples of appropriate messages to use with the two calls to die()? I don't fully understand what's being tested and could fail at those points in the script. More generally, how might I flesh out the error handling in the script to make it more robust? What's the difference between a process and a thread? When and why would I choose to use multiple processes rather than multiple threads and vice versa? I'm running Microsoft Windows, not Unix or Linux. How much does this matter? If there's an easier or slicker way to compute a timestamp than how I did it here using POSIX::strftime() and localtime(), I'd appreciate a tip. Thank you again for your help. Jim
In Section
Seekers of Perl Wisdom
|
|