Hello all, is there some way for code within a signal handler to affect the greater program? I found
Setting up signal handlers for an object with access to $self, which has allowed me access to my data within the signal handler, but neither changes to the object nor the
%ENVironment seem to persist. I suspect it's not possible, but am wondering if there's something I am overlooking.
For those curious, the goal is to install a handler that will handle broken pipes elegantly and fail over to a fallback. $SIG{PIPE} = 'IGNORE' is insufficient, and wrapping the calls that work with the pipe in eval{} fails the elegance test…
Cheers!
UPDATE: In the end it turned out to be possible to get information out of the signal handler, but block eval was still required. However I hit upon a relatively elegant means of using it: Rather than wrapping multiple statements within eval. I decided to put everything in an eval block, and use it as a replacement for do in my control structure e.g;
eval{
...
} while ($condition);
--
In Bob We Trust, All Others Bring Data.