AnyEvent and Strawberry perl issue
Laurent
laurent.aml at gmail.com
Wed Mar 11 22:35:17 CET 2015
Hi,
Following up on https://rt.perl.org/Public/Bug/Display.html?id=121727
Apparently, in my setup of Strawberry Perl 5.20, syswrite reports
POSIX::EWOULDBLOCK (140) instead of the WSAEWOULDBLOCK (10035) or EAGAIN.
In particular, this makes the readline test fail:
C:\0\strawberry-perl-5.20.2.1-32bit\cpan\build\AnyEvent-7.08-zCulrH>..\..\..\perl\bin\perl.exe
-Ilib t\handle\01_readline.t
1..8
ok 1 - A line was read correctly
ok 2
ok 3 - initial lines were read correctly
AnyEvent::Handle uncaught error: A non-blocking socket operation could not
be completed immediately. at t\handle\01_readline.t line 77.
# Looks like you planned 8 tests but ran 3.
# Looks like your test exited with 140 just after 3.
Note sure how to fix that.
Apparently, Perl 5.12 introduced the POSIX error codes for winsock (see
http://perldoc.perl.org/5.12.0/perldelta.html). In particular, EWOULDBLOCK
and EINPROGRESS are now supported on Windows.
I would suggest the following, but can't tell if it would work on any
windows flavor/version:
--- src/constants.pl.PL 2013-07-31 20:50:59.000000000 -0400
+++ src-patched/constants.pl.PL 2015-03-11 17:28:41.572898600 -0400
@@ -85,9 +85,10 @@
# broken windows perls use undocumented error codes...
if ($WIN32) {
- i WSAEINVAL => 10022;
- i WSAEWOULDBLOCK => 10035;
- i WSAEINPROGRESS => 10036;
+ # Assumes winsock errors have been translated to POSIX values when
EWOULDBLOCK has been introduced, in Perl 5.12.
+ i WSAEINVAL => eval { POSIX::EWOULDBLOCK() && POSIX::EINVAL() } ||
10022;
+ i WSAEWOULDBLOCK => eval { POSIX::EWOULDBLOCK() } || 10035;
+ i WSAEINPROGRESS => eval { POSIX::EINPROGRESS() } || 10036;
} else {
# these should never match any errno value
i WSAEINVAL => -1e99;
-- Laurent
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.schmorp.de/pipermail/anyevent/attachments/20150311/5f526259/attachment.html>
More information about the anyevent
mailing list