3 # Copyright (c) 1997-8 Graham Barr <gbarr@pobox.com>. All rights reserved.
4 # This program is free software; you can redistribute it and/or
5 # modify it under the same terms as Perl itself.
7 package IO
::Socket
::UNIX
;
15 @ISA = qw(IO::Socket);
18 IO
::Socket
::UNIX
->register_domain( AF_UNIX
);
22 unshift(@_, "Peer") if @_ == 1;
23 return $class->SUPER::new
(@_);
30 my $type = $arg->{Type
} || SOCK_STREAM
;
32 $sock->socket(AF_UNIX
, $type, 0) or
35 if(exists $arg->{Local
}) {
36 my $addr = sockaddr_un
($arg->{Local
});
40 if(exists $arg->{Listen
} && $type != SOCK_DGRAM
) {
41 $sock->listen($arg->{Listen
} || 5) or
44 elsif(exists $arg->{Peer
}) {
45 my $addr = sockaddr_un
($arg->{Peer
});
46 $sock->connect($addr) or
54 @_ == 1 or croak
'usage: $sock->hostpath()';
55 my $n = $_[0]->sockname || return undef;
60 @_ == 1 or croak
'usage: $sock->peerpath()';
61 my $n = $_[0]->peername || return undef;
65 1; # Keep require happy
71 IO::Socket::UNIX - Object interface for AF_UNIX domain sockets
79 C<IO::Socket::UNIX> provides an object interface to creating and using sockets
80 in the AF_UNIX domain. It is built upon the L<IO::Socket> interface and
81 inherits all the methods defined by L<IO::Socket>.
89 Creates an C<IO::Socket::UNIX> object, which is a reference to a
90 newly created symbol (see the C<Symbol> package). C<new>
91 optionally takes arguments, these arguments are in key-value pairs.
93 In addition to the key-value pairs accepted by L<IO::Socket>,
94 C<IO::Socket::UNIX> provides.
96 Type Type of socket (eg SOCK_STREAM or SOCK_DGRAM)
97 Local Path to local fifo
98 Peer Path to peer fifo
99 Listen Create a listen socket
101 If the constructor is only passed a single argument, it is assumed to
102 be a C<Peer> specification.
105 NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE
107 As of VERSION 1.18 all IO::Socket objects have autoflush turned on
108 by default. This was not the case with earlier releases.
110 NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE
120 Returns the pathname to the fifo at the local end
124 Returns the pathanme to the fifo at the peer end
130 L<Socket>, L<IO::Socket>
134 Graham Barr. Currently maintained by the Perl Porters. Please report all
135 bugs to <perl5-porters@perl.org>.
139 Copyright (c) 1996-8 Graham Barr <gbarr@pobox.com>. All rights reserved.
140 This program is free software; you can redistribute it and/or
141 modify it under the same terms as Perl itself.