#700619 no easy way to use Net::DNS::RR->new () with arbitrary "type"

#700619#5
Date:
2013-02-15 10:37:26 UTC
From:
To:
	There doesn't seem to be an easy way to create a Net::DNS::RR
	instance given a “pre-parsed” resource record serialization
	(such as one read from a XML or CSV file, or an SQL database.)

	Consider, e. g.:

## as read, e. g., from a CSV file
my @rrs
    = (["foo.example.org", "AAAA",  "2001:db8:1337::cafe"],
       ["bar.example.org", "CNAME", "foo.example.org"]);

foreach my $rr (@rrs) {
    ## FIXME: this switch shouldn't be necessary
    my $key
        = ($rr->[1] eq "AAAA"     ? "address"
	   : $rr->[1] eq "CNAME"  ? "cname"
	   : ...);
    my $rr
        = Net::DNS::RR->new ("name" => $rr->[0], "type" => $rr->[1],
                             $key   => $rr->[2]);
}

	Obviously, this is further complicated by the fact that certain
	RR's include more than one payload value (MX, SRV, etc.)

	A possible work-around function is MIME'd (based on the the
	Net::DNS::RR->new_from_string () constructor's code), which, I
	believe, should be possible to adapt into a proper Net::DNS::RR
	constructor.

	TIA.