<A HREF="#item_select"><CODE>select</CODE></A> is a static method, that is you call it with the package
name like <A HREF="#item_new"><CODE>new</CODE></A>. <CODE>READ</CODE>, <CODE>WRITE</CODE> and <CODE>ERROR</CODE> are either <A HREF="../../lib/Pod/perlfunc.html#item_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>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
error conditions respectively. Upon error an empty array is returned.</P>
<P></P></DL>
<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>
<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>
<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>