NAME
Haineko::DNS - Tiny resolver class
DESCRIPTION
Haineko::DNS provide methods for resolving internet domain such as A, MX, NS, and TXT resource record.
SYNOPSIS
use Haineko::DNS;
my $e = Haineko::DNS->new('example.org'); # Target domain name is example.org
my $v = $e->resolve('a'); # Resolve A resource record
CLASS METHODS
new( Domain Name )
new()
is a constructor of Haineko::DNS
use Haineko::DNS;
my $e = Haineko::DNS->new('example.org');
map { $e->resolve( $_ ) } ( qw|a mx ns txt| );
warn Data::Dumper::Dumper $e;
$VAR1 = bless( {
'NS' => [
{
'exp' => 1384606375,
'p' => 0,
'ttl' => 72657,
'rr' => 'a.iana-servers.net'
},
{
'exp' => 1384606375,
'p' => 0,
'ttl' => 72657,
'rr' => 'b.iana-servers.net'
}
],
'MX' => [],
'A' => [
{
'exp' => 1384572613,
'p' => 0,
'ttl' => 38895,
'rr' => '93.184.216.119'
}
],
'name' => 'example.org',
'TXT' => [
{
'exp' => 1384533778,
'p' => 0,
'ttl' => 60,
'rr' => 'v=spf1 -all'
},
{
'exp' => 1384533778,
'p' => 0,
'ttl' => 60,
'rr' => '$Id: example.org 1924 2013-10-21 04:00:42Z dknight $'
}
]
}, 'Haineko::DNS' );
INSTANCE METHODS
resolve(Type)
resolve()
set resource records of specified type into the object .
use Haineko::DNS;
my $e = Haineko::DNS->new('example.org');
my $v = $e->arr;
my $w = $e->mxrr;
print for @$v; # 93.184.216.119
print for @$w; #
rr(Type)
rr()
returns the list of resource records as an array reference
use Haineko::DNS;
my $e = Haineko::DNS->new('gmail.com');
my $v = $e->rr('MX');
print for @$v; # gmail-smtp-in.l.google.com,alt1.gmail-smtp-in.l.google.com,
# alt2.gmail-smtp-in.l.google.com,alt3.gmail-smtp-in.l.google.com,
# alt4.gmail-smtp-in.l.google.com
$e = Haineko::DNS->new('perl.org');
$v = $e->rr('A');
print for @$v; # 207.171.7.53, 207.171.7.43
arr()
arr()
is an alias for rr('A');
mxrr()
mxrr()
is an alias for rr('MX');
nsrr()
nsrr()
is an alias for rr('NS');
txtrr()
txtrr()
is an alias for rr('TXT');
REPOSITORY
https://github.com/azumakuniyuki/Haineko
AUTHOR
azumakuniyuki <perl.org [at] azumakuniyuki.org>
LICENSE
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.