aboutsummaryrefslogtreecommitdiff
blob: f132b25ac3c70859a4bee29b5fafe0a753a2224c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/perl -w

use strict;

use Gentoo::PerlMod::Version "gentooize_version";
use IO::Socket::UNIX;

my $SOCK_PATH = $ARGV[0];
if (not defined $SOCK_PATH) {
	die "missing UNIX domain socket path\n";
}

my $client = IO::Socket::UNIX->new(
	Type => SOCK_STREAM(),
	Peer => $SOCK_PATH,
)
	or die("can't connect to python server: $!\n");

$client->autoflush(1);

while (my $line = <$client>) {
	if (defined $line) {
		chomp($line);
		my $version = gentooize_version($line);
		$client->send(sprintf("%02d", length $version));
		$client->send($version);
	}
}