<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><BR><DIV><DIV>On Aug 15, 2005, at 6:13 AM, Ilya Zaytsev wrote:</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite"><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">I have a perfectly working perl script under winxp and now I'm trying</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">to rewrite it to call select (and IO::Select) on mail box handle but</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">no success. select call returns -1 and IO::Select-&gt;can_read doesn't</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">read events. I have seen the XS source code but nothing comes to my</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">head. The same technique woks fine for C code.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Does anybody experienced the same problem?</DIV></BLOCKQUOTE></DIV><FONT class="Apple-style-span" color="#0000DD"><BR class="khtml-block-placeholder"></FONT><DIV><FONT class="Apple-style-span" color="#0000DD">Without a code segment, it's hard to say.  The connect command in Spread returns a list of two things:</FONT></DIV><DIV><FONT class="Apple-style-span" color="#0000DD"> ( $mbox, $private_group )</FONT></DIV><DIV><FONT class="Apple-style-span" color="#0000DD"><BR class="khtml-block-placeholder"></FONT></DIV><DIV><FONT class="Apple-style-span" color="#0000DD">The $mbox is an IV in perlguts terms, which means it is a scalar value representation of the file descriptor.  This is becuase Spread returns a mailbox that _happens_ to be a filedescriptor.  The API allows Spread to be more creative and return some sort of psuedo handle, so watch out for future incompatibility.</FONT></DIV><DIV><FONT class="Apple-style-span" color="#0000DD"><BR class="khtml-block-placeholder"></FONT></DIV><DIV><FONT class="Apple-style-span" color="#0000DD">Something like:</FONT></DIV><DIV><FONT class="Apple-style-span" color="#0000DD"><BR class="khtml-block-placeholder"></FONT></DIV><DIV><FONT class="Apple-style-span" color="#0000DD">use IO::Select;</FONT></DIV><DIV><FONT class="Apple-style-span" color="#0000DD">use IO::Handle;</FONT></DIV><DIV><FONT class="Apple-style-span" color="#0000DD">my $mbox, $ioh;</FONT></DIV><DIV><FONT class="Apple-style-span" color="#0000DD">... do you Spread connect stuff and jam the mailbox in $mbox;</FONT></DIV><DIV><FONT class="Apple-style-span" color="#0000DD"><BR class="khtml-block-placeholder"></FONT></DIV><DIV><FONT class="Apple-style-span" color="#0000DD">my $ioh = IO::Handle-&gt;fdopen($mbox, "rw");</FONT></DIV><DIV><FONT class="Apple-style-span" color="#0000DD"><BR class="khtml-block-placeholder"></FONT></DIV><DIV><FONT class="Apple-style-span" color="#0000DD">You should be able to IO::Select on $ioh as a normal "IO" handle now.  It works in UNIX :-)  Windows file descriptors aren't contiguous and it emulates select() under the hood in a fairly expensive way.  I _assume_ that Perl uses the emulation for IO::Select or there would be ample documentation stating that it didn't work.  You are changing the $mbox into an actual IO object, right?</FONT></DIV><DIV><FONT class="Apple-style-span" color="#0000DD"><BR class="khtml-block-placeholder"></FONT></DIV><DIV><FONT class="Apple-style-span" color="#0000DD">Cheers ;-)</FONT></DIV><DIV><FONT class="Apple-style-span" color="#0000DD"><BR class="khtml-block-placeholder"></FONT></DIV><BR><BR><DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT face="Helvetica" size="3" style="font: 11.0px Helvetica">// Theo Schlossnagle</FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT face="Helvetica" size="3" style="font: 11.0px Helvetica">// Principal Engineer -- <A href="http://www.omniti.com/~jesus/">http://www.omniti.com/~jesus/</A></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT face="Helvetica" size="3" style="font: 11.0px Helvetica">// OmniTI Computer Consulting, Inc. -- <A href="http://www.omniti.com">http://www.omniti.com</A>/</FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT face="Helvetica" size="3" style="font: 11.0px Helvetica">// Ecelerity: fastest MTA on Earth</FONT></DIV> <BR class="Apple-interchange-newline"> </DIV><BR></BODY></HTML>