Author: wayland
Date: 2009-03-31 02:30:46 +0200 (Tue, 31 Mar 2009)
New Revision: 26030

Modified:
   docs/Perl6/Spec/S32-setting-library/IO.pod
Log:
S32/IO:
-       Merged IO::Listening into IO::Socket
-       Made IO::Socket implement IO::Closeable
-       Added a $.Listening attribute to IO::Socket.  


Modified: docs/Perl6/Spec/S32-setting-library/IO.pod
===================================================================
--- docs/Perl6/Spec/S32-setting-library/IO.pod  2009-03-30 19:10:15 UTC (rev 
26029)
+++ docs/Perl6/Spec/S32-setting-library/IO.pod  2009-03-31 00:30:46 UTC (rev 
26030)
@@ -451,8 +451,9 @@
 
 =head2 IO::Socket
 
-    role IO::Socket {
+    role IO::Socket does IO::Closeable {
         has %.options;
+        has Bool $.Listening = 0;
         ...
     }
 
@@ -460,31 +461,42 @@
 
 =over
 
-=item pair
+=item new
 
-    method pair(Int $domain, Int $type, Int $protocol --> List of IO)
+    method new
 
-A wrapper for I<socketpair(2)>, returns a pair of C<IO> objects representing 
the
-reader and writer ends of the socket.
+=item open
 
-   use Socket;
-   ($r, $w) = Socket.pair(AF_UNIX, SOCK_STREAM, PF_UNSPEC);
+    method open()
 
+If $.Listening is true, does a I<bind(2)> and a I<listen(2)>, otherwise does a 
+I<connect(2)>.  
 
-=back
+It's end-user use case is intended for the case where NoOpen is passed to 
.new().  .new() 
+itself will presumably also call it.  
 
-=head2 IO::Listening
+=item close
 
-=item open
+    method close()
 
-    method open()
+Reimplements the close() function from IO::Closeable by doing a shutdown on 
the connection 
+(see below) with @how set to ('Readable', 'Writeable').   
 
-Does a I<bind(2)> and a I<listen(2)>.
+=item shutdown
 
+    method shutdown(Array of Str @how)
+
+Does a I<shutdown(2)> on the connection.  See also IO::Readable.isReadable and 
+IO::Writeable.isWriteable.  
+
+$how can contain 1 or more of the strings 'Readable' and 'Writeable'.  
+
 =item accept
 
     method accept( --> IO::Socket)
 
+=back
+
 =head2 IO::FileDescriptor
 
 This role indicates that this object actually represents an open file
@@ -872,6 +884,7 @@
 =head2 IO::Socket::INET
 
     class IO::Socket::INET does IO::Socket does IO::Streamable {
+        has Str $.Protocol = 'TCP';
         ...
     }
 
@@ -890,9 +903,10 @@
     method new(
         Str :$RemoteHost, Str :$RemotePort, 
         Str :$LocalHost, Str :$LocalPort, 
+        Str :$Protocol, # Initialises $.Protocol
         Bool :$Blocking, 
         Bool :$NoOpen,
-        Str :$Protocol = 'TCP'
+        Bool :$Listening, # Initialises $.Listening from IO::Socket
        --> IO::Socket::INET
     ) {...}
 
@@ -900,14 +914,6 @@
 
 IPv6 is supported.  
 
-=item open
-
-    method open()
-
-If it's not an C<IO::Listening>, it does a C<connect()>.
-
-It's intended for the case where the creation of the object didn't do one.  
-
 =item method read($buf is rw, Int $bytes --> Int)
 
 Does a I<recv(2)>.  
@@ -1042,6 +1048,24 @@
 the stat fails, all subsequent tests on the stat buffer also evaluate
 to false.
 
+=head2 IO::Socket::Unix
+
+=over
+
+=item pair
+
+    method pair(Int $domain, Int $type, Int $protocol --> List of IO)
+
+A wrapper for I<socketpair(2)>, returns a pair of C<IO> objects representing 
the
+reader and writer ends of the socket.
+
+   use IO::Socket;
+   ($r, $w) = IO::Socket::Unix.pair(AF_UNIX, SOCK_STREAM, PF_UNSPEC);
+
+
+=back
+
+
 =head2 IO::POSIX
 
 Indicates that this object can perform standard posix C<IO>

Reply via email to