AnyEvent and Strawberry perl issue

Marc Lehmann schmorp at schmorp.de
Sun Mar 15 03:04:48 CET 2015


On Fri, Mar 13, 2015 at 11:36:34AM -0400, Laurent <laurent.aml at gmail.com> wrote:
> Given what you are saying, would the following be too naive?

If only 5.019004+ is to be supported, I think it would probably be
fine. I am not convinced that "WIN32" is the exact test required (there
is considerable variety betwen win32 perls, and I don't want to support
strawberry perl only).

> I have not seen EINPROGRESS used much in AnyEvent

No, but it's in one of the most-used functions :)

There are also similar issues with all other WSA error codes, though. In
AnyEvent::Loop, the test for WSAEINVAL could probably be guarded by WIN32
alone, plus checking for both EINVAL and 10022. Or doing what IO::Socket
in 5.20 does and what perl5porters apparently expect for every perl
program now:

            elsif (!connect($sock,$addr) &&
                not ($!{EISCONN} || ($^O eq 'MSWin32' &&
                ($! == (($] < 5.019004) ? 10022 : Errno::EINVAL))))

and hardcoding WSA error numbers together with a 5.019004 version check,
and hoping for the best. (Such as, it will work on 5.012 and other
versions with interesting related changes).

It seems this has mostly become an issue with 5.20 only, which explains
why it wasn't spotted before.

> (Coro::Handle has a similar check, though).

I was completely unaware, great to point this out. This change is going to
subtly break a lot of code...

-- 
                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_              http://www.deliantra.net
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      schmorp at schmorp.de
      -=====/_/_//_/\_,_/ /_/\_\



More information about the anyevent mailing list