Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Re: Sockets, eval , and DIE

by mr_mischief (Monsignor)
on Apr 17, 2014 at 16:56 UTC ( #1082665=note: print w/replies, xml ) Need Help??

in reply to Sockets, eval , and DIE

You're talking about signals here, not regular error conditions within a single program. Writing to a closed pipe gets you a SIGPIPE signal.

If you want to survive a signal, you need a signal handler for that signal. In perldoc you're wanting the perlipc section. There's a page for perlipc or run perldoc perlipc locally.

Replies are listed 'Best First'.
Re^2: Sockets, eval , and DIE
by Wiggins (Hermit) on Apr 17, 2014 at 17:45 UTC
    BINGO !!
    SIGPIPE="IGNORE" allowed the code to continue. Now to wrestle with "Don't test for what you aren't prepared to handle!"

    It is always better to have seen your target for yourself, rather than depend upon someone else's description.

      Alternatively, one can use "send" instead of "syswrite". Like this

      use Socket qw(MSG_NOSIGNAL); use Errno; my $out = send($sock, $data, MSG_NOSIGNAL); unless(defined $out) { if($!{EPIPE}) { warn("Got broken pipe\n"); } }
      In this case SIGPIPE is not provided, only EPIPE system error happens, which allows handling of all errors in single place.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1082665]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2018-06-24 21:14 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (126 votes). Check out past polls.