[net-dns-users] How to translate the email in SOA
Dick Franks
rwfranks at acm.org
Sat Dec 22 13:39:10 UTC 2012
On 22 December 2012 10:45, Feng He <fenghe at nsbeta.info> wrote:
> I am sorry that Net::DNS::Mailbox does nothing what I thought.
Net::DNS::Mailbox is an internal component which is not designed to be
used by end users.
> For translating an email address into SOA I have to write a subroutine like:
There is no need to do that!
If you use Net::DNS 0.69 or later, all the conversions are done for you.
#!/usr/bin/perl -w
use Net::DNS 0.69;
my $resolver = new Net::DNS::Resolver();
my $example = 'nsbeta.info';
my $reply = $resolver->send( $example, 'SOA' ) || die;
my ($soa) = grep { $_->type eq 'SOA' } $reply->answer;
$soa->print;
print "RNAME mailbox: ", $soa->rname, "\n";
my $different = 'john.doe at example.com';
print "\n\nchanged RNAME: ", $soa->rname($different), "\n\n";
$soa->print;
exit;
More information about the net-dns-users
mailing list