AnyEvent::Socket and Windows

Marc Lehmann schmorp at
Thu Sep 27 14:59:44 CEST 2012

On Thu, Sep 27, 2012 at 02:23:17PM +0200, Henrik Pauli <henrik.pauli at> wrote:
> I ran into a little issue with AnyEvent::Socket under Win32, which,
> while it turned out to be a result of us overriding $SIG{__DIE__}, I
> think it might still be worth a mention.  Of course, the problem can
> be solved with locally undefining the signal handler, so it's not
> really an issue.

Sounds like a buggy __DIE__ handler - the correct solution would be to
teach your die handler to work as expected under eval.

> Socket::pack_sockaddr_un), but in the case of a $SIG{__DIE__}
> override it runs the callback (and in our case, exits the

That's clearly a bug in your code then.

> So I wonder if replacing (or augmenting) the eval {} with an unless
> AnyEvent::WIN32 would make any sense.

No, the problem doesn't happen because of win32, it happens because of a
buggy die handler that exits the app when it shouldn't do so. The only
place to fix it is in your die handler.

AnyEvent cetrainly isn't the only perl code that uses exceptions, and it
seems your die handler completely breaks this part of the language. While
you are free to to do so, you also get to keep the pieces then :)

                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_    
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      schmorp at
      -=====/_/_//_/\_,_/ /_/\_\

More information about the anyevent mailing list