belg4mit has asked for the wisdom of the Perl Monks concerning the following question:
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.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Spooky actions from a signal handler possible?
by BrowserUk (Patriarch) on Feb 24, 2015 at 19:51 UTC | |
by belg4mit (Prior) on Feb 24, 2015 at 20:30 UTC | |
Re: Spooky actions from a signal handler possible?
by RonW (Parson) on Feb 24, 2015 at 20:19 UTC | |
by belg4mit (Prior) on Feb 24, 2015 at 20:36 UTC |