Skip Menu |
 

This queue is for tickets about the IO-Multiplex CPAN distribution.

Report information
The Basics
Id: 23982
Status: resolved
Priority: 0/
Queue: IO-Multiplex

People
Owner: Nobody in particular
Requestors: junk [...] penilecolada.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.08
Fixed in: (no value)



Subject: [Fix] Win32 compatability + diff
Download (untitled) / with headers
text/plain 495b
The consistant failure to install this module on Win32-based systems[1] is due to the port's lacking required Fcntl macros; This is a known flaw [2][3]. The attached .diff has been tested on ActiveState's 5.8.8 build for MSWin32-x86-multi-thread and makes use of the work-around provided by the 2nd and 3rd links. - Links: [1] http://cpantesters.perl.org/show/IO-Multiplex.html#IO-Multiplex-1.08 [2] http://perlmonks.org/?node_id=529812 [3] http://rt.cpan.org/Public/Bug/Display.html?id=11938
Subject: IO-Multiplex.diff
Download IO-Multiplex.diff
text/x-diff 1.2k
279a280,282 > }; > if($^O eq q{MSWin32}){ > sub EWOULDBLOCK { return 10035 } 636,641c639,646 < next if < $! == EINTR || < $! == EAGAIN || < $! == EWOULDBLOCK; < warn "IO::Multiplex read error: $!" < if $! != ECONNRESET; --- > next > if $! == EINTR > || $! == EAGAIN > || $! == EWOULDBLOCK; > > # WSAEFAULT|10014 > warn "IO::Multiplex read error: $!|" . int($!) > if $! != ECONNRESET; 920,924c925,935 < my $fh = shift; < my $flags = fcntl($fh, F_GETFL, 0) < or die "fcntl F_GETFL: $!\n"; < fcntl($fh, F_SETFL, $flags | O_NONBLOCK) < or die "fcntl F_SETFL $!\n"; --- > my ($fh) = @_; > if ($^O eq q{MSWin32}) { > ioctl($fh, 0x8004667e, 1); > } > else { > my $flags = fcntl($fh, F_GETFL, 0) > or die "fcntl F_GETFL: $!\n"; > fcntl($fh, F_SETFL, $flags | O_NONBLOCK) > or die "fcntl F_SETFL $!\n"; > } > return; 926a938 > 1078d1089 <
Download (untitled) / with headers
text/plain 288b
Did this get applied to the module? I see that this patch is for 1.08 and 1.10 is out now. The 1.10 version doesn't install in Win32 properly for the same reasons (it seems). I'm using ActivePerl 5.10.0 1004 in WinXP and attempted install via CPAN. Rob, do you have any ideas or tips?
Patch for Perl5.10 (including patched tests)
Subject: multiplex.diff
Download multiplex.diff
text/x-diff 3k
diff -ruN IO-Multiplex-1.10/lib/IO/Multiplex.pm IO-Multiplex-wcopy/lib/IO/Multiplex.pm --- IO-Multiplex-1.10/lib/IO/Multiplex.pm 2008-09-15 10:17:50.000000000 +0100 +++ IO-Multiplex-wcopy/lib/IO/Multiplex.pm 2010-03-01 13:54:39.368977700 +0000 @@ -278,9 +278,12 @@ # Can optionally use Hi Res timers if available require Time::HiRes; Time::HiRes->import ('time'); - } + }; + no warnings; + if($^O =~ /^mswin/i){ sub EWOULDBLOCK () { 10035 } } }; + # This is what you want. Trust me. $SIG{PIPE} = 'IGNORE'; @@ -645,12 +648,14 @@ if $obj && $obj->can("mux_input"); } else { unless (defined $rv) { - next if - $! == EINTR || - $! == EAGAIN || - $! == EWOULDBLOCK; - warn "IO::Multiplex read error: $!" - if $! != ECONNRESET; + next + if $! == EINTR + || $! == EAGAIN + || $! == EWOULDBLOCK; + + # WSAEFAULT|10014 + warn "IO::Multiplex read error: $!|" . int($!) + if $! != ECONNRESET; } # There's an error, or we received EOF. If # there's pending data to be written, we leave @@ -929,12 +934,8 @@ sub nonblock { - return 1 if IsWin; my $fh = shift; - my $flags = fcntl($fh, F_GETFL, 0) - or die "fcntl F_GETFL: $!\n"; - fcntl($fh, F_SETFL, $flags | O_NONBLOCK) - or die "fcntl F_SETFL $!\n"; + defined($fh->blocking(0)) or die("Blocking : $!\n"); } sub fd_set diff -ruN IO-Multiplex-1.10/t/110_ntest.t IO-Multiplex-wcopy/t/110_ntest.t --- IO-Multiplex-1.10/t/110_ntest.t 2002-11-25 23:47:12.000000000 +0000 +++ IO-Multiplex-wcopy/t/110_ntest.t 2010-03-01 15:29:25.014847100 +0000 @@ -58,10 +58,13 @@ print "ok 10\n"; my $flags = 0; -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"; + +#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"; + +defined($server_socket->blocking(1)) or die("Blocking : $!\n"); if (syswrite ($client_socket, $test_msg1, length $test_msg1) == 10) { print "ok 11\n"; diff -ruN IO-Multiplex-1.10/t/200_udp.t IO-Multiplex-wcopy/t/200_udp.t --- IO-Multiplex-1.10/t/200_udp.t 2003-07-31 23:20:28.000000000 +0100 +++ IO-Multiplex-wcopy/t/200_udp.t 2010-03-01 14:06:20.687424100 +0000 @@ -20,6 +20,11 @@ use IO::Multiplex; use POSIX qw(ENOTCONN EDESTADDRREQ); +if( $^O =~ /^mswin/i ) { + *ENOTCONN = sub () { 10057; }; +} + + $| = 1; plan tests => 15;
Download (untitled) / with headers
text/plain 336b
Patch partially taken for 1.11, to be released soon. Although the code uses $socket on various places, it may also have pipes or even files as handles (supported on some UNIXes/Linux). The blocking method is not defined on everything. Code formatting will stay with the preference of the original author. Thanks for the contribution.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.