use strict;
use warnings;
use IO::Socket::UNIX;
my $server = IO::Socket::UNIX->new(
Local => '/tmp/path/to/socket',
Type => SOCK_STREAM,
Listen => 5,
) or die $@;
The client code that produced the error was
use strict;
use warnings;
use IO::Socket::UNIX;
my $socket = IO::Socket::UNIX->new(
Peer => '/tmp/path/to/socket',
Type => SOCK_STREAM,
) or die $@;
print $socket "command away\n";
It turns out that my client was exiting before the server could respond. By the time the server responded, the client had disappeared and no "peer address" was available. By adding
my $response = <$socket>
to the end of the script, the client waited for the server's response and everything worked great.