in reply to Re: unexpected program abort on write on closed handle
in thread unexpected program abort on write on closed handle

I'd like the syswrite() to simply return undef, nothing more. My existing code then will throw away the socket and try to (re-)connect to any available server.
TRY: for (1 .. $maxretries) { eval { $sock ||= outconnect() || die $diag=$!; my $lw = syswrite($sock, $$data); die $! unless defined $lw and $lw == length($$data); $$data = ''; }; if (my $e = $@) { $diag ||= $e; $sock = undef; next TRY;
PS: Setting it to 'IGNORE' works just fine: Exception: Broken pipe at /root/iotest.pl line 31.

Search, Ask, Know

Replies are listed 'Best First'.
Re^3: unexpected program abort on write on closed handle
by anonymized user 468275 (Curate) on Jul 25, 2005 at 09:35 UTC
    You are of course right, that it can be made to be ignored. I forgot that because I am used to project standards that require all fatal conditions to at the least be written to a log file for review by production support personnel, even though this often leads to huge logfiles that need to be regularly archived off!

    One world, one people