in reply to Run a program and allow user to interactivly stop it.

To kill the spawned script from the parent, you need to get the pid of the forked process. Just one word of caution, sometimes, the pid returned is the bash shell pid of your process, so you sometimes need to deal with that issue of finding a pid with a parent pid of some value. In that case look at the Proc::Killfam module.

If you are willing to go to an event-loop system,(GLib,POE,Tk,Gtk2,etc) many cool things are possible. See Readkey with timer using Glib for a Glib control loop, and Perl/Tk front-end to mplayer for some tricks on how to control mplayer.... you need to use it's slave mode.


I'm not really a human, but I play one on earth. Cogito ergo sum a bum
  • Comment on Re: Run a program and allow user to interactivly stop it.