[dns-operations] creeping poorness of judgement

John Levine johnl at taugh.com
Tue Mar 17 02:18:53 UTC 2020


In article <20200317014627.GW68408 at straasha.imrryr.org> you write:
>Yes, the txtdata() method concatenates with spaces in a scalar context.

Net::DNS is pretty funky.  The txtdata() output method is something
that someone apparently thought was useful a long time ago but it's
neither the master file format nor the wire format

Here's what it gives you if you ask for that record formatted for a master file,
or hex of the wire format:

 use Net::DNS;
 print $Net::DNS::VERSION . "\n";
 $rr = new Net::DNS::RR( name    => 'name',
       type    => 'TXT',
      txtdata => [ 'multiple', 'strings', 'string with spaces' ]
 );

 print "master format: "; $rr->print;

 print "encoded: ",unpack("H*",$rr->encode(0)),"\n";

$ perl text.pl

1.21
master format: name.    IN      TXT     multiple strings "string with spaces"
encoded: 046e616d650000100001000000000024086d756c7469706c6507737472696e677312737472696e67207769746820737061636573

You get just what you'd expect, no stray spaces in the master record
or in the binary.

-- 
Regards,
John Levine, johnl at taugh.com, Primary Perpetrator of "The Internet for Dummies",
Please consider the environment before reading this e-mail. https://jl.ly


More information about the dns-operations mailing list