Skip Menu |

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

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

People
Owner: rt-cpan [...] triv.org
Requestors: nathan [...] anderson-net.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: (no value)



Subject: PATCH: Further Perl 5.004 compatibility fixes
I'll try to make this brief. First off: Net-DNS-0.31 $ perl -v This is perl, version 5.004_04 built for i586-linux $ uname -a Linux socrates 2.0.33 #6 Thu Aug 23 23:20:53 PDT 2001 i686 unknown (*sigh*...YES, it's old ;-)) I'm not much of a Perl coder myself; I needed Net-DNS so that I could install Vipul's Razor (see http://razor.sf.net/) on this old box (acting as a small-time mail server for my family) with a very hacked-up Slackware 3.5 (libc5) install on it. I would upgrade Perl except I didn't want to chance breaking other things at this time, and eventually when I do get time I intend on wiping out everything and installing a modern Linux distribution. Razor itself came with an older (0.23) version of Net-DNS, and the included documentation seemed to indicate that 5.005_03 was the earliest version of Perl that was supported by Net-DNS. I noticed in the Changelogs that as of 0.27 *untested* 5.004 compatibility was included, so I grabbed the latest version (0.31 at the time of this writing) and gave it a go. However, there were a few problems: 1) my version of pod2man chokes on the FAQ man page with the error "Invalid man page - 1st pod line is not NAME". This is corrected, for whatever reason, by adding a blank line between the version string and the first POD command paragraph. 2) ALL tests fail as a result of a "syntax error" on line 540 of Packet.pm. After doing some research, I discovered that the syntax used on that line (EXPR for[each] @list;) was not supported until 5.005; thus, I had to change it to look like foreach (@list) { EXPR; } 3) One of the test scripts itself failed because of the same problem as in item 2 above (appending a foreach modifier to a statement: not supported in 5.004). Lines 82 and 88 of 04-pkt-safe-push.t have to have the same treatment as Packet.pm did. 4) And finally, after all of the above was taken care of, some tests caused non-fatal warnings to occur: "Ambiguous use of {format} resolved to {"format"} at blib/lib/Net/DNS/RR/CERT.pm" for lines 98, 99 (twice), and 118. Apparently this is a bug in 5.004 since (from what I've read) {hash} is always considered a string anyway and never a bareword, but warnings annoy, and even if not for the sake of 5.004 users' piece of mind, at least for the sake of consistency you might as well enclose those four strings in quotes (though naturally I'm not trying to dictate; it's just a suggestion :-)). After making these changes, I finally got all the tests to complete with no errors or warnings on my system (though I will admit that I don't know if *everything* works; haven't installed Razor yet, so we shall see). All simple fixes, but I've included a patch anyway (against 0.31). I hope this helps, and thanks for all of your great work! -- Nathan
diff -r -d -u -N Net-DNS-0.31/lib/Net/DNS/FAQ.pod Net-DNS-0.31-perl5.004/lib/Net/DNS/FAQ.pod --- Net-DNS-0.31/lib/Net/DNS/FAQ.pod Fri Nov 15 11:09:41 2002 +++ Net-DNS-0.31-perl5.004/lib/Net/DNS/FAQ.pod Wed Dec 4 01:41:48 2002 @@ -1,4 +1,5 @@ $Id: FAQ.pod,v 1.3 2002/11/15 10:43:53 ctriv Exp $ + =head1 NAME Net::DNS::FAQ - Frequently Asked Net::DNS Questions diff -r -d -u -N Net-DNS-0.31/lib/Net/DNS/Packet.pm Net-DNS-0.31-perl5.004/lib/Net/DNS/Packet.pm --- Net-DNS-0.31/lib/Net/DNS/Packet.pm Sat Oct 12 12:16:14 2002 +++ Net-DNS-0.31-perl5.004/lib/Net/DNS/Packet.pm Wed Dec 4 01:41:52 2002 @@ -537,7 +537,9 @@ return; } - $self->{'seen'}{$_->string}++ for @rr; + foreach (@rr) { + $self->{'seen'}{$_->string}++; + } } =head2 safe_push diff -r -d -u -N Net-DNS-0.31/lib/Net/DNS/RR/CERT.pm Net-DNS-0.31-perl5.004/lib/Net/DNS/RR/CERT.pm --- Net-DNS-0.31/lib/Net/DNS/RR/CERT.pm Sat Jul 6 17:44:56 2002 +++ Net-DNS-0.31-perl5.004/lib/Net/DNS/RR/CERT.pm Wed Dec 4 01:42:02 2002 @@ -95,8 +95,8 @@ my $cert = MIME::Base64::encode $self->{certificate}; $cert =~ s/\n//g; - my $format = defined $r_formats{$self->{format}} - ? $r_formats{$self->{format}} : $self->{format}; + my $format = defined $r_formats{$self->{"format"}} + ? $r_formats{$self->{"format"}} : $self->{"format"}; my $algorithm = defined $r_algorithms{$self->{algorithm}} ? $r_algorithms{$self->{algorithm}} : $self->{algorithm}; @@ -115,7 +115,7 @@ my $rdata = ""; if (exists $self->{"format"}) { - $rdata .= pack("n2", $self->{format}, $self->{tag}); + $rdata .= pack("n2", $self->{"format"}, $self->{tag}); $rdata .= pack("C", $self->{algorithm}); $rdata .= $self->{certificate}; } diff -r -d -u -N Net-DNS-0.31/t/04-pkt-safe-push.t Net-DNS-0.31-perl5.004/t/04-pkt-safe-push.t --- Net-DNS-0.31/t/04-pkt-safe-push.t Fri Oct 11 00:57:56 2002 +++ Net-DNS-0.31-perl5.004/t/04-pkt-safe-push.t Wed Dec 4 01:41:39 2002 @@ -79,13 +79,17 @@ my $packet = Net::DNS::Packet->new($domain); - $packet->safe_push($section, $_) for @rrs; + foreach (@rrs) { + $packet->safe_push($section, $_); + } is($packet->header->$count_meth(), $count, "$section right"); # Now we test the parsing in new. my $packet2 = Net::DNS::Packet->new(\($packet->data)); - $packet2->safe_push($section, $_) for @rrs; + foreach (@rrs) { + $packet2->safe_push($section, $_); + } is($packet2->header->$count_meth(), $count, "$section right"); }
[guest - Wed Dec 4 04:48:09 2002]: [summary of 5.004 fixes] Show quoted text
> I hope this helps, and thanks for all of your great work!
Thanks for the patch, these changes will be in the next release of Net::DNS. -- Chris Reinhardt ctriv@dyndns.org Systems Architect Dynamic DNS Network Services http://www.dyndns.org/