1#!/usr/bin/perl 2 3use strict; 4use warnings; 5 6use Test::More; 7use Net::DNS::Packet; 8 9require IO::Async::Resolver::DNS::NetDNSImpl; 10 11my $data = IO::Async::Resolver::DNS::res_query( "www.cpan.org", "IN", "A" ); 12ok( defined $data, 'res_query' ); 13 14my $pkt = Net::DNS::Packet->new( \$data ); 15ok( defined $pkt, 'res_query returns valid DNS packet' ); 16 17# Since we don't want to be too sensitive to what DNS actually claims about 18# www.cpan.org at the current time, just check the question is what we asked 19is( ($pkt->question)[0]->qname, "www.cpan.org", '$pkt qname' ); 20is( ($pkt->question)[0]->qclass, "IN", '$pkt qclass' ); 21is( ($pkt->question)[0]->qtype, "A", '$pkt qtype' ); 22 23ok( defined IO::Async::Resolver::DNS::res_search( "www.cpan.org", "IN", "A" ), 24 'res_search' ); 25 26done_testing; 27