[net-dns-users] How to translate the email in SOA

Feng He fenghe at nsbeta.info
Fri Jan 11 03:07:05 UTC 2013


Thanks all for your response on this thread.

To  get the email from a SOA, I have done with:

sub get_soa {

     my $zone = shift;
     my $host = '127.0.0.1';

     my $res   = Net::DNS::Resolver->new(nameservers => [$host]);
     my $query = $res->query($zone, "SOA");
     if (defined $query) {
         return ($query->answer)[0];
     } else {
         return;
     }
}

my $re=$ds->get_soa("test.com");
print $re->rname,"\n";

This print the email address with normal format.

I have been using nsupdate (which is called as an external command 
within Perl) to update the SOA record, so how to commit the encoded 
email string?

I have wrote the subroutine like:

sub format_email_for_soa {

     my $email = shift;
     my ($user,$tld) = split/\@/,$email;
     $user =~ s/\./\\./g;
     $user. '.' .$tld . '.';
}

But I am not sure whether it satisfy all  the cases.

Thanks.





More information about the net-dns-users mailing list