AnyEvent::Socket::getprotobyname()

Marc Lehmann schmorp at schmorp.de
Tue Feb 15 10:52:30 CET 2011


On Mon, Feb 14, 2011 at 10:10:37PM -0800, gleeco <gleeco at gmail.com> wrote:
> not firing (at least on my platform: centOS 5.3, perl 5.8.8; AnyEvent
> 5.3).  Purr-haps you've seen how these constant-ish ops work whilst
> digging in to the Socket internals?

your platform is, like, 10 years outdated, and certainly not worth
optimising for - if you upgrade your perl to one of the last 6 or so
releases, this will just work.

> here's patch/test to AnyEvent::Socket v.5.3:

the patch has major problems:

> > $PROTO_BYNAME{tcp}  = Socket::IPPROTO_TCP () if defined Socket::IPPROTO_TCP;

this is always true, whether the constant exists or not (and with use
strict, will be a compiletime error when it doesn't exist!).

> > warn __PACKAGE__ , " getprotobyname($name) called\t", ((exists  $PROTO_BYNAME{$name}) ? "TRUE" : "FALSE" ), "\n";

You probably meant to remove that :)

If you really need to run with an antique perl and the correct behaviour
of looking the protocol up in the file is really such a problem for you,
you can call the Socket::IPPROTO_TCP function in a BEGIN before using
AnyEvent, that will *probably* ensure that the defined works.

-- 
                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