in reply to Give me my gui back!

Well, I think that, at a high level, what you want to do is to treat the running sub-process as a source of events for your main loop.

Essentially, when you fork off the child, open a pipe to read from it (bi-directional would be harder, but still possible). Here's the basic idea:

$pid = open(KID_TO_READ, "-|"); die "Unable to fork: $!\n" unless defined $pid; if (!$pid) { # child exec($program, @options, @args) or die "Can't exec $program: $!\n"; }
Then, in your main-loop, do a non-blocking read from KID_TO_READ. (There are plenty of good examples around here of how to use IO::Select for non-blocking reads.) Anyway, you take that non-blocking read as an additional source of incoming events into your main loop. That way, you can be kept constantly abrest of the status of the executing job.

Also, since you've got the pid of the executing job, you can tie a button in your GUI to send a signal (like INT to stop, etc) to your job.


------------
:Wq
Not an editor command: Wq