perlquestion
belg4mit
Hello all, is there some way for code within a signal handler to affect the greater program? I found [id://8065], which has allowed me access to my data within the signal handler, but neither changes to the object nor the <code>%ENV</code>ironment seem to persist. I suspect it's not possible, but am wondering if there's something I am overlooking.
<p>
For those curious, the goal is to install a handler that will handle broken pipes elegantly and fail over to a fallback. <code>$SIG{PIPE} = 'IGNORE'</code> is insufficient, and wrapping the calls that work with the pipe in <code>eval{}</code> fails the elegance test…
Cheers!
<p>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 <code>do</code> in my control structure e.g;</p>
<code>
eval{
...
} while ($condition);
</code>
<!-- Node text goes above. Div tags should contain sig only -->
<div class="pmsig"><div class="pmsig-45366">
<p>
<tt>
-- <br>
In Bob We Trust, All Others Bring Data.
</tt>
</div></div>