note
atcroft
<p>I know you may have your reasons for looking at the record in a particular way, but why not use a module that is made for doing this, [cpan://Net::DNS]?
<p>Below was a quick example of using [cpan://Net::DNS] to retrieve similar information:
<readmore>
<code>
#!/usr/bin/perl
use strict;
use warnings;
use Net::DNS;
my $res = Net::DNS::Resolver->new;
my $target;
# Single-target test
$target = q{entrust.net};
# To run from command-line, uncomment loop below
# foreach my $target ( @ARGV )
{
my $reply = $res->query( q{entrust.net}, q{CAA}, );
if ( $reply ) {
foreach my $rr ( $reply->answer ) {
# Complete response
$rr->print;
# Individual response components
print qq{Owner: }, $rr->owner, qq{\n};
print qq{Type: }, $rr->type, qq{\n};
print qq{Class: }, $rr->class, qq{\n};
print qq{TTL: }, $rr->ttl, qq{\n};
# RR-specific data as string
print qq{RDstring: }, $rr->rdstring, qq{\n};
# RR-specific data components
print qq{Flags: }, $rr->flags, qq{\n};
print qq{Critical: }, $rr->critical, qq{\n};
print qq{Tag: }, $rr->tag, qq{\n};
print qq{Value: }, $rr->value, qq{\n};
print qq{\n};
}
else {
warn qq{query failed: }, $res->errorstring, qq{\n};
}
}
}
</code>
<p>Output:
<code>
entrust.net. 6168 IN CAA 0 iodef mailto:ecs.support\@entrustdatacard.com
Owner: entrust.net
Type: CAA
Class: IN
TTL: 6168
RDstring: 0 iodef mailto:ecs.support\@entrustdatacard.com
Flags: 0
Critical: 0
Tag: iodef
Value: mailto:ecs.support@entrustdatacard.com
entrust.net. 6168 IN CAA 0 issue entrust.net
Owner: entrust.net
Type: CAA
Class: IN
TTL: 6168
RDstring: 0 issue entrust.net
Flags: 0
Critical: 0
Tag: issue
Value: entrust.net
</code>
</readmore>
<p>Hope that helps.
1209245
1209245