If you are really running the actual server code you showed, your code would greatly benefit from
use strict;
because you have two or three variables confusingly named the same:
$SIG{ 'TERM' } = $SIG{ 'INT' } = sub { $socket->close(); }; $SIG{ 'PIPE' } = 'IGNORE'; my $client_socket; # creating a listening socket my $socket = new IO::Socket::INET ( LocalHost => '0.0.0.0', LocalPort => $port, Proto => 'tcp', Listen => 5, Reuse => 1 );
Either the declaration of $socket should be moved above your $SIG{ 'TERM' } = $SIG{ 'INT' } handlers, or the variable $socket is intended to be $client_socket, and then the declaration of $client_socket should be moved upwards.
If you want to dissociate your process children from their parent, you might have to do something like Complete Dissociation of Child from Parent and/or the double fork.
In reply to Re: IO:Socket::INET: Strategies against death of child processes on broken pipe
by Corion
in thread IO:Socket::INET: Strategies against death of child processes on broken pipe
by Bloehdian
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |