Definitely do a “Super Search” on this one, because it is a frequently asked question. There are at least three aspects to this FAQ:
- How to go about receiving the signal, especially in Perl’s version of multi-threading.
- How to cause the program to stop, not “in its trac...” but, “at an appropriate stopping-point, as soon as possible.”
- How to efficiently wait for the signal to resume.
... and ... heh
... how to do that and debug that without losing your remaining hair in the process.
Start searching here.