我可以通过Perl确定给定的“主机名”是否为CNAME
发布时间:2020-12-16 06:20:35 所属栏目:大数据 来源:网络整理
导读:在工作中,我有这样的事情…… $host www.something.comwww.something.com is an alias for some.other.addresssome.other.address is an alias for one.more.addressone.more.address has address xxx.xxx.xxx.xxx 我想在Perl中放入www.something.com并确定
在工作中,我有这样的事情……
$host www.something.com www.something.com is an alias for some.other.address some.other.address is an alias for one.more.address one.more.address has address xxx.xxx.xxx.xxx 我想在Perl中放入www.something.com并确定它是否是CNAME,A记录等. 解决方法use Net::DNS qw(); my $query = Net::DNS::Resolver->new->search('conferences.yapceurope.org'); if ($query) { foreach my $rr ($query->answer) { next unless 'CNAME' eq $rr->type; print $rr->cname; } } else { warn sprintf "query failed: %sn",$res->errorstring; } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |