in reply to Using simultaneous threads

Is there any reason why you shuffle the output of the mysqldump through perl? You don't seem to do anything else with the data. Why not let a shell pipe do the work?

system("$cmd > $dumpfile")==0 or die ...;
Now to start two of them simultaneous you could do a fork (which is clean and easy). Small caveat: You can easily check whether the child process finished, but to get a status/success/failure message, you would need a file or some IPC. But don't worry, some helpful monk will probably tell you about a module that already does most of this.

Just for completeness sake: There is also the possibility of letting the shell fork:

system("$cmd > $dumpfile &")==0 or die ...;
The '&' makes sure the system call returns immediately, so that you can start the second dump directly afterwards. To find out whether the child finished you could check the output of ps, but that is a dirty und unsafe hack in my view.

Replies are listed 'Best First'.
Re^2: Using simultaneous threads
by waba (Monk) on May 13, 2008 at 17:17 UTC
    Small caveat: You can easily check whether the child process finished, but to get a status/success/failure message, you would need a file or some IPC. But don't worry, some helpful monk will probably tell you about a module that already does most of this.

    I remember using Proc::SafeExec some weeks ago and finding its interface quite intuitive. I was solving a simpler problem, but it will probably work here just as well.