Subject: | MSWin broken |
Hi,
Attached patch for seems to fix Win32 usage with sockets
It contains
1) Fix for ioctl call
2) removal of warnings on some sub defs
Regards
Mark
Subject: | iomp.diff |
diff -ruNw IO-Multiplex-1.11/lib/IO/Multiplex.pm IO-Multiplex-1.11a/lib/IO/Multiplex.pm
--- IO-Multiplex-1.11/lib/IO/Multiplex.pm 2011-02-02 16:41:16.000000000 +0000
+++ IO-Multiplex-1.11a/lib/IO/Multiplex.pm 2011-02-23 20:39:11.201768600 +0000
@@ -278,13 +278,16 @@
# Can optionally use Hi Res timers if available
require Time::HiRes;
Time::HiRes->import('time');
- }
};
+}
# This is what you want. Trust me.
$SIG{PIPE} = 'IGNORE';
-if(IsWin) { *EWOULDBLOCK = sub {10035} }
+{
+ no warnings;
+ if(IsWin()) { sub EWOULDBLOCK () { 10035 } }
+}
=head2 new
@@ -938,7 +941,8 @@
{ my $fh = shift;
if(IsWin)
- { ioctl($fh, 0x8004667e, 1);
+ {
+ ioctl($fh, 0x8004667e, pack("L!", 1));
}
else
{ my $flags = fcntl($fh, F_GETFL, 0)
diff -ruNw IO-Multiplex-1.11/t/110_ntest.t IO-Multiplex-1.11a/t/110_ntest.t
--- IO-Multiplex-1.11/t/110_ntest.t 2002-11-25 23:47:12.000000000 +0000
+++ IO-Multiplex-1.11a/t/110_ntest.t 2011-02-23 20:28:26.365168600 +0000
@@ -58,10 +58,17 @@
print "ok 10\n";
my $flags = 0;
+
+if($^O eq 'MSWin32') {
+ ioctl($server_socket, 0x8004667e, pack("L!", 0));
+
+} else {
+
fcntl($server_socket, F_GETFL, $flags)
or die "fcntl F_GETFL: $!\n";
fcntl($server_socket, F_SETFL, $flags & ~O_NONBLOCK)
or die "fcntl F_SETFL $!\n";
+}
if (syswrite ($client_socket, $test_msg1, length $test_msg1) == 10) {
print "ok 11\n";
diff -ruNw IO-Multiplex-1.11/t/200_udp.t IO-Multiplex-1.11a/t/200_udp.t
--- IO-Multiplex-1.11/t/200_udp.t 2011-02-02 11:28:24.000000000 +0000
+++ IO-Multiplex-1.11a/t/200_udp.t 2011-02-23 19:41:28.190168600 +0000
@@ -19,8 +19,10 @@
use IO::Socket;
use IO::Multiplex;
use POSIX qw(ENOTCONN EDESTADDRREQ);
-
+{
+ no warnings;
if($^O eq 'MSWin32') { *ENOTCONN = sub(){10057} }
+}
$| = 1;
plan tests => 15;