xchg has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I am currently developing IPv4 multicasting application and I need to set socket option IP_ADD_MEMBERSHIP. The problem is I can't find this constant defined in any module (I did grep on /usr/lib/perl). So how do I import this and other IP related constants? I can still look at /usr/include/netinet/in.h and make my own constants but I was hoping perl has some way. I can't use 3rd party modules, just basic perl.

Replies are listed 'Best First'.
Re: IP constants from netinet/in.h in perl
by Anonymous Monk on Apr 03, 2011 at 23:27 UTC
      No I can't, it has to be pure perl without installing some 3rd party stuff. I've checked modules and it seems they all create their own constants or use C for networking, so these constants aren't probably defined anywhere in perl.
        so these constants aren't probably defined anywhere in perl.

        Probably not

        You could use h2ph / h2pl

Re: IP constants from netinet/in.h in perl
by thargas (Deacon) on Apr 05, 2011 at 12:24 UTC
    Is there a reason why you can't just bundle a copy of the required module from CPAN with your application? Say IO::Socket::Multicast? I've done that before.