Main Content

How to interact with a Perl program while it is processing data

Archive - Originally posted on "The Horse's Mouth" - 2011-07-31 16:34:10 - Graham Ellis

If you have a long running program, how do you monitor its progress?

You could use tail -f on an output file ... but there are other options too.

a) You can output a progress line; there's an example of this from the recent Perl for Larget Projects course ... [here].

b) You can trap ^C ... and even have it generate a report (that's included in the same example)

c) You can set up your process to arrange to dump out "results to date" if you send it a signal. That too is imlemented in the same example, and the program that sends the signal is [here]

Lots of tricks / comments / specifics I could tell you about in the example. If it's not obvious how it works, take a look at the course ;-)