This uses Unix domain sockets, it's from the perlipc manpage.
you didn't specify what you were looking for
#!/usr/bin/perl -w
# The client
use Socket;
use strict;
my ($socky, $line);
$socky = shift || '/tmp/mysock';
socket(SOCK, PF_UNIX, SOCK_STREAM, 0) || die "socket: $!";
connect(SOCK, sockaddr_un($socky)) || die "connect: $!";
while (defined($line = <SOCK>)) {
print $line;
}
exit;
#################
#!/usr/bin/perl -wT
# The server
use Socket;
use strict;
use Carp;
BEGIN {
$ENV{PATH} = '/usr/ucb:/bin';
}
sub logit {
print "$0 $$: @_ at ", scalar localtime, "\n";
}
my $NAME = '/tmp/mysock';
my $uaddr = sockaddr_un($NAME);
my $proto = getprotobyname('tcp');
socket(Server,PF_UNIX,SOCK_STREAM,0) || die "socket: $!";
unlink($NAME);
bind (Server, $uaddr) || die "bind: $!";
listen(Server,SOMAXCONN) || die "listen: $!";
logit "server started on $NAME";
my $waitedpid;
sub REAPER {
$waitedpid = wait;
$SIG{CHLD} = \&REAPER;
logit "reaped $waitedpid" . ($? ? " with exit $?" : '');
}
$SIG{CHLD} = \&REAPER;
for ($waitedpid = 0;
accept(Client,Server) || $waitedpid;
$waitedpid = 0, close Client) {
next if $waitedpid;
logit "connection on $NAME";
spawn sub {
print "Hello there, it's now ", scalar localtime, "\n";
exec '/usr/games/fortune' or die "can't exec fortune:
+$!";
};
}