From 5b2b4265a4ca06736cc541f992fdfb655f6e3a21 Mon Sep 17 00:00:00 2001 From: Pierre-Olivier Mercier Date: Mon, 20 Jan 2014 10:58:59 +0100 Subject: [PATCH] Can use comm-socket with argument --- comm-socket.pl | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/comm-socket.pl b/comm-socket.pl index e9c1b0f3..3748db21 100644 --- a/comm-socket.pl +++ b/comm-socket.pl @@ -7,12 +7,22 @@ use threads; die("Give at least the socket file as argument") if (! @ARGV); +my $sock_path = shift @ARGV; + my $socket = IO::Socket::UNIX->new( Type => SOCK_STREAM, - Peer => $ARGV[0], + Peer => $sock_path, ); -die "Can't create socket: $!" unless $socket; +die "Can't read socket ($sock_path): $!" unless $socket; + +if (@ARGV) +{ + while (my $arg = shift @ARGV) + { + say $socket $arg; + } +} my $s = IO::Select->new();