I can't explain this behaviour...
#!/usr/bin/perl use Net::DNS; #use IO::Socket::IP; $testcandidate="cl"; print "IPV4 test...\n"; $res = new Net::DNS::Resolver; $res->tcp_timeout (1) ; $res->retry (1) ; $res->retrans (1) ; $query = $res->nameservers('162.219.53.120'); $query = $res->query($testcandidate, "SOA"); print "What's in the array: \n"; print join ' ', $res->nameservers(); print "\n"; my $serial=($query->answer)[0]->serial, if ($query); print "serial: $serial\n"; print "\n\nIPV6 test...\n"; $res = new Net::DNS::Resolver; $res->tcp_timeout (1) ; $res->retry (1) ; $res->retrans (1) ; $query = $res->nameservers('2620:10a:80d1:1053::120'); $query = $res->query($testcandidate, "SOA"); print "What's in the array: \n"; print join ' ', $res->nameservers(); print "\n"; my $serial=($query->answer)[0]->serial, if ($query); print "serial: $serial\n";
Which outputs...
[root@ns01 jzack]# ./snippet IPV4 test... What's in the array: 162.219.53.120 serial: 2020070925 IPV6 test... What's in the array: serial:
How is it that the IPv6 address isn't even being mentioned when I print the array elements? I thought I was debugging a Net::DNS issue...but it seems I must be doing something wrong with arrays in general? When I throw this into debug, I see: IPV6 test... ;; query(cl, SOA) ;; setting up an AF_INET() family type UDP socket So how do I get it to not use AF_INET?

In reply to Re: Net::DNS::Resolver using IPv6 transport in nameservers by elsifsheep
in thread Net::DNS::Resolver using IPv6 transport in nameservers by elsifsheep

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.