Skip Menu |

This queue is for tickets about the Net-DNS CPAN distribution.

Report information
The Basics
Id: 7750
Status: resolved
Priority: 0/
Queue: Net-DNS

People
Owner: Nobody in particular
Requestors: abuse [...] cabal.org.uk
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.48
Fixed in: (no value)



Subject: Net::DNS is failing well-formed calls to RR methods complaining about wrong type of RR
I have found a case where, even though I have checked that a RR is of the correct type, calling a method appropriate to that RR fails. Here's what I narrowed it down to: #!/usr/bin/perl -w require 5.6.0; use strict; use Data::Dumper; use Net::DNS; my $res=new Net::DNS::Resolver; my $pkt=$res->query('uucp-gw-2.pa.dec.com', 'A'); foreach ($pkt->answer) { next if $_->type ne 'A'; my $ip=$_->ipaddress; print Data::Dumper->Dump ( [ $_, $ip, $Net::DNS::VERSION ], [ qw( _ ip Net::DNS::VERSION ) ] ); } __END__ That script outputs the following: $ perl net-dns-bugtest.pl *** *** WARNING!!! The program has attempted to call the method *** "ipaddress" for the following RR object: *** *** uucp-gw-2.pa.dec.com. 6217 IN A 204.123.2.19 *** *** This object doesn't have a method "ipaddress". THIS IS A BUG *** IN THE CALLING SOFTWARE, which has incorrectly assumed that *** the object would be of a particular type. The calling *** software should check the type of each RR object before *** calling any of its methods. *** *** Net::DNS has returned undef to the caller. *** at net-dns-bugtest.pl line 12 $_ = bless( { 'rdlength' => 4, 'ttl' => 6217, 'name' => 'uucp-gw-2.pa.dec.com', 'address' => '204.123.2.19', 'class' => 'IN', 'type' => 'A', 'rdata' => 'Ì{' }, 'Net::DNS::RR::A' ); $ip = undef; $Net::DNS::VERSION = '0.48'; As you can see, it's definitely an A RR that I'm calling the ipaddress method on, but that call fails with an error. It succeeds on other hostnames I've tried, and dig works on that hostname. This is running on Debian 'sarge' using its packages of Perl 5.8.4 and Net::DNS 0.48.
Date: Thu, 23 Sep 2004 07:37:10 -0600
From: Michael Fuhr <mike [...] fuhr.org>
To: Guest via RT <bug-Net-DNS [...] rt.cpan.org>
Subject: Re: [cpan #7750] Net::DNS is failing well-formed calls to RR methods complaining about wrong type of RR
RT-Send-Cc:
See below. On Thu, Sep 23, 2004 at 08:38:05AM -0400, Guest via RT wrote: [snip] Show quoted text
> *** > *** WARNING!!! The program has attempted to call the method > *** "ipaddress" for the following RR object: > *** > *** uucp-gw-2.pa.dec.com. 6217 IN A 204.123.2.19 > *** > *** This object doesn't have a method "ipaddress". THIS IS A BUG > *** IN THE CALLING SOFTWARE, which has incorrectly assumed that > *** the object would be of a particular type. The calling > *** software should check the type of each RR object before > *** calling any of its methods. > *** > *** Net::DNS has returned undef to the caller. > ***
[snip] Show quoted text
> > As you can see, it's definitely an A RR that I'm calling the > ipaddress method on, but that call fails with an error. It succeeds > on other hostnames I've tried, and dig works on that hostname.
Where did you find documentation of an ipaddress method? The Net::DNS::RR::A manual page documents address, not ipaddress: http://www.net-dns.org/docs/Net/DNS/RR/A.html You said ipaddress works on other hostnames -- could you please provide an example? -- Michael Fuhr http://www.fuhr.org/~mfuhr/