In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/cf74bc378c0a30c6c73f0a998cb89eaeb3bfb617?hp=39d6ec9c0d20d3d03ac0955f489d90a12a2cc0cc>
- Log ----------------------------------------------------------------- commit cf74bc378c0a30c6c73f0a998cb89eaeb3bfb617 Author: Shlomi Fish <shlo...@shlomifish.org> Date: Mon Jan 13 14:16:29 2014 +0200 Add examples for IO::Socket::UNIX. In the SYNOPSIS. See http://www.nntp.perl.org/group/perl.perl5.porters/2014/01/msg211274.html: <QUOTE> From: Shlomi Fish Subject: Patch for perldoc IO::Socket::UNIX I noticed http://perldoc.perl.org/IO/Socket/UNIX.html does not contain any examples (including not in the synopsis). If acceptable, I can a prepare a patch that will include a simple server and a client for UNIX domain sockets, see: http://www.mail-archive.com/beginners%40perl.org/msg116942.html </QUOTE> TC: modified the version number modification M dist/IO/lib/IO/Socket/UNIX.pm commit 4669477507dea6690f5159501db099ef513b16d1 Author: Shlomi Fish <shlo...@shlomifish.org> Date: Mon Jan 13 13:54:00 2014 +0200 Remove an old note about autoflush from the POD. For IO::Socket::UNIX. See: http://www.nntp.perl.org/group/perl.perl5.porters/2014/01/msg211275.html <QUOTE> And while you're at it, you might as well get rid of the autoflush note, given IO::Socket 1.18 being fairly ancient (it shipped with 5.6.0). </QUOTE> M dist/IO/lib/IO/Socket/UNIX.pm ----------------------------------------------------------------------- Summary of changes: dist/IO/lib/IO/Socket/UNIX.pm | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/dist/IO/lib/IO/Socket/UNIX.pm b/dist/IO/lib/IO/Socket/UNIX.pm index 4f3f898..30b8f74 100644 --- a/dist/IO/lib/IO/Socket/UNIX.pm +++ b/dist/IO/lib/IO/Socket/UNIX.pm @@ -12,7 +12,7 @@ use IO::Socket; use Carp; @ISA = qw(IO::Socket); -$VERSION = "1.25"; +$VERSION = "1.26"; $VERSION = eval $VERSION; IO::Socket::UNIX->register_domain( AF_UNIX ); @@ -74,6 +74,28 @@ IO::Socket::UNIX - Object interface for AF_UNIX domain sockets use IO::Socket::UNIX; + my $SOCK_PATH = "$ENV{HOME}/unix-domain-socket-test.sock"; + + # Server: + my $server = IO::Socket::UNIX->new( + Type => SOCK_STREAM(), + Local => $SOCK_PATH, + Listen => 1, + ); + + my $count = 1; + while (my $conn = $server->accept()) { + $conn->print("Hello " . ($count++) . "\n"); + } + + # Client: + my $client = IO::Socket::UNIX->new( + Type => SOCK_STREAM(), + Peer => $SOCK_PATH, + ); + + # Now read and write from $client + =head1 DESCRIPTION C<IO::Socket::UNIX> provides an object interface to creating and using sockets @@ -103,13 +125,6 @@ be a C<Peer> specification. If the C<Listen> argument is given, but false, the queue size will be set to 5. - NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE - -As of VERSION 1.18 all IO::Socket objects have autoflush turned on -by default. This was not the case with earlier releases. - - NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE - =back =head1 METHODS -- Perl5 Master Repository