<?xml version="1.0" encoding="windows-1252"?>
<node id="984838" title="How to require IPv6 support" created="2012-08-01 13:11:42" updated="2012-08-01 13:11:42">
<type id="115">
perlquestion</type>
<author id="933574">
mbethke</author>
<data>
<field name="doctext">
&lt;p&gt;I've just extended my [Net::CIDR::Lookup] module with an IPv6 version and am seeing a lot of &lt;a href="http://www.cpantesters.org/cpan/report/d078b122-db1a-11e1-9066-3d54fb7543f5"&gt;failed tests form CPANtesters&lt;/a&gt;. Clearly an oversight: I just assumed [Socket] would nowadays always export &lt;code&gt;unpack_sockaddr_in6&lt;/code&gt; and the like. This needs fixing but there's two things I'm not clear about:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Is there a halfway easy way nowadays to find the oldest version of a module that supports a certain feature in the first place? Searching around here I found a half-decade-old thread that mentions it's a tedious process, but I knew that already :) Basically bisecting one's way through every version on BackPAN should be rather straightforward, maybe someone has written some code for it already?&lt;/li&gt;
&lt;li&gt;Now I think the IPv6-Socket problem may even be a bit more complicated as e.g. &lt;code&gt;unpack_sockaddr_in6&lt;/code&gt; will only actually be functional if the system had IPv6 support at XS compile time, otherwise it's there but croaks when called. I'm quite sure [mod://ExtUtils::MakeMaker] has no way of checking a prerequisite for anything else but a version number, but maybe something like [mod://Module::Build] does? I haven't found anything like it in the docs but I suppose something like this would make sense---a sub instead of a version that just returns a boolean indicating whether the installed version is acceptable:
&lt;code&gt;
PREREQ_PM =&gt; {
        'Bit::Vector' =&gt; 0,
        Socket =&gt; sub {
            eval {
                Socket::unpack_sockaddr_in6("\xa".("\0"x22)."\x01\0\0\0\0");
                1;
            } or do { $@ and return 0; }
        }        
    },
&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;</field>
</data>
</node>
