|laziness, impatience, and hubris|
Timing External Program Executionby cameronbprince (Acolyte)
|on Oct 20, 2002 at 02:26 UTC||Need Help??|
cameronbprince has asked for the
wisdom of the Perl Monks concerning the following question:
I have coded a script that loops over MP3's in a given directory. The script runs an external command, mp3_check on each file with IPC::Open3, parses it's output, then adds the data to an Oracle table with DBI/DBD.
The problem with this is the mp3_check command sometimes hangs on problem files. What I would like to do is setup a timer of some sort then run the command. If the child process doesn't complete before the timer expires, I'd like to kill the process and continue with the loop over the files.
Here is the code I've got now to call the external program and gather it's output:
Could anyone give me ideas as to how to setup a timer of say 5 seconds on this, then kill it if the timer expires?