Edit D:\app\Administrator\product\11.2.0\dbhome_1\perl\html\lib\IO\Select.html
<?xml version="1.0" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>IO::Select - OO interface to the select system call</title> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <link rev="made" href="mailto:" /> </head> <body style="background-color: white"> <table border="0" width="100%" cellspacing="0" cellpadding="3"> <tr><td class="block" style="background-color: #cccccc" valign="middle"> <big><strong><span class="block"> IO::Select - OO interface to the select system call</span></strong></big> </td></tr> </table> <!-- INDEX BEGIN --> <div name="index"> <p><a name="__index__"></a></p> <ul> <li><a href="#name">NAME</a></li> <li><a href="#synopsis">SYNOPSIS</a></li> <li><a href="#description">DESCRIPTION</a></li> <li><a href="#constructor">CONSTRUCTOR</a></li> <li><a href="#methods">METHODS</a></li> <li><a href="#example">EXAMPLE</a></li> <li><a href="#author">AUTHOR</a></li> <li><a href="#copyright">COPYRIGHT</a></li> </ul> <hr name="index" /> </div> <!-- INDEX END --> <p> </p> <h1><a name="name">NAME</a></h1> <p>IO::Select - OO interface to the select system call</p> <p> </p> <hr /> <h1><a name="synopsis">SYNOPSIS</a></h1> <pre> use IO::Select;</pre> <pre> $s = IO::Select->new();</pre> <pre> $s->add(\*STDIN); $s->add($some_handle);</pre> <pre> @ready = $s->can_read($timeout);</pre> <pre> @ready = IO::Select->new(@handles)->can_read(0);</pre> <p> </p> <hr /> <h1><a name="description">DESCRIPTION</a></h1> <p>The <code>IO::Select</code> package implements an object approach to the system <a href="#select"><code>select</code></a> function call. It allows the user to see what IO handles, see <a href="file://C|\ADE\aime_smenon_perl_090715\perl\html/lib/IO/Handle.html">the IO::Handle manpage</a>, are ready for reading, writing or have an exception pending.</p> <p> </p> <hr /> <h1><a name="constructor">CONSTRUCTOR</a></h1> <dl> <dt><strong><a name="new" class="item">new ( [ HANDLES ] )</a></strong> <dd> <p>The constructor creates a new object and optionally initialises it with a set of handles.</p> </dd> </li> </dl> <p> </p> <hr /> <h1><a name="methods">METHODS</a></h1> <dl> <dt><strong><a name="add" class="item">add ( HANDLES )</a></strong> <dd> <p>Add the list of handles to the <code>IO::Select</code> object. It is these values that will be returned when an event occurs. <code>IO::Select</code> keeps these values in a cache which is indexed by the <a href="file://C|\ADE\aime_smenon_perl_090715\perl\html/pod/perlfunc.html#fileno"><code>fileno</code></a> of the handle, so if more than one handle with the same <a href="file://C|\ADE\aime_smenon_perl_090715\perl\html/pod/perlfunc.html#fileno"><code>fileno</code></a> is specified then only the last one is cached.</p> </dd> <dd> <p>Each handle can be an <code>IO::Handle</code> object, an integer or an array reference where the first element is an <code>IO::Handle</code> or an integer.</p> </dd> </li> <dt><strong><a name="remove" class="item">remove ( HANDLES )</a></strong> <dd> <p>Remove all the given handles from the object. This method also works by the <a href="file://C|\ADE\aime_smenon_perl_090715\perl\html/pod/perlfunc.html#fileno"><code>fileno</code></a> of the handles. So the exact handles that were added need not be passed, just handles that have an equivalent <a href="file://C|\ADE\aime_smenon_perl_090715\perl\html/pod/perlfunc.html#fileno"><code>fileno</code></a></p> </dd> </li> <dt><strong><a name="exists" class="item">exists ( HANDLE )</a></strong> <dd> <p>Returns a true value (actually the handle itself) if it is present. Returns undef otherwise.</p> </dd> </li> <dt><strong><a name="handles" class="item">handles</a></strong> <dd> <p>Return an array of all registered handles.</p> </dd> </li> <dt><strong><a name="can_read" class="item">can_read ( [ TIMEOUT ] )</a></strong> <dd> <p>Return an array of handles that are ready for reading. <code>TIMEOUT</code> is the maximum amount of time to wait before returning an empty list, in seconds, possibly fractional. If <code>TIMEOUT</code> is not given and any handles are registered then the call will block.</p> </dd> </li> <dt><strong><a name="can_write" class="item">can_write ( [ TIMEOUT ] )</a></strong> <dd> <p>Same as <a href="#can_read"><code>can_read</code></a> except check for handles that can be written to.</p> </dd> </li> <dt><strong><a name="has_exception" class="item">has_exception ( [ TIMEOUT ] )</a></strong> <dd> <p>Same as <a href="#can_read"><code>can_read</code></a> except check for handles that have an exception condition, for example pending out-of-band data.</p> </dd> </li> <dt><strong><a name="count" class="item">count ()</a></strong> <dd> <p>Returns the number of handles that the object will check for when one of the <code>can_</code> methods is called or the object is passed to the <a href="#select"><code>select</code></a> static method.</p> </dd> </li> <dt><strong><a name="bits" class="item"><code>bits()</code></a></strong> <dd> <p>Return the bit string suitable as argument to the core <a href="#select"><code>select()</code></a> call.</p> </dd> </li> <dt><strong><a name="select" class="item">select ( READ, WRITE, EXCEPTION [, TIMEOUT ] )</a></strong> <dd> <p><a href="#select"><code>select</code></a> is a static method, that is you call it with the package name like <a href="#new"><code>new</code></a>. <code>READ</code>, <code>WRITE</code> and <code>EXCEPTION</code> are either <a href="file://C|\ADE\aime_smenon_perl_090715\perl\html/pod/perlfunc.html#undef"><code>undef</code></a> or <code>IO::Select</code> objects. <code>TIMEOUT</code> is optional and has the same effect as for the core select call.</p> </dd> <dd> <p>The result will be an array of 3 elements, each a reference to an array which will hold the handles that are ready for reading, writing and have exceptions respectively. Upon error an empty list is returned.</p> </dd> </li> </dl> <p> </p> <hr /> <h1><a name="example">EXAMPLE</a></h1> <p>Here is a short example which shows how <code>IO::Select</code> could be used to write a server which communicates with several sockets while also listening for more connections on a listen socket</p> <pre> use IO::Select; use IO::Socket;</pre> <pre> $lsn = new IO::Socket::INET(Listen => 1, LocalPort => 8080); $sel = new IO::Select( $lsn );</pre> <pre> while(@ready = $sel->can_read) { foreach $fh (@ready) { if($fh == $lsn) { # Create a new socket $new = $lsn->accept; $sel->add($new); } else { # Process socket</pre> <pre> # Maybe we have finished with the socket $sel->remove($fh); $fh->close; } } }</pre> <p> </p> <hr /> <h1><a name="author">AUTHOR</a></h1> <p>Graham Barr. Currently maintained by the Perl Porters. Please report all bugs to <<a href="mailto:perl5-porters@perl.org">perl5-porters@perl.org</a>>.</p> <p> </p> <hr /> <h1><a name="copyright">COPYRIGHT</a></h1> <p>Copyright (c) 1997-8 Graham Barr <<a href="mailto:gbarr@pobox.com">gbarr@pobox.com</a>>. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.</p> <table border="0" width="100%" cellspacing="0" cellpadding="3"> <tr><td class="block" style="background-color: #cccccc" valign="middle"> <big><strong><span class="block"> IO::Select - OO interface to the select system call</span></strong></big> </td></tr> </table> </body> </html>
Ms-Dos/Windows
Unix
Write backup
jsp File Browser version 1.2 by
www.vonloesch.de