Net::DNS::Paranoid - paranoid dns resolver
my $dns = Net::DNS::Paranoid->new(); $dns->blocked_hosts([ 'mixi.jp', qr{\.dev\.example\.com$}, ]); $dns->whitelisted_hosts([ 'twitter.com', ]); my ($addrs, $errmsg) = $dns->resolve('mixi.jp'); if ($addrs) { print @$addrs, $/; } else { die $errmsg; }
This is a wrapper module for Net::DNS.
This module detects IP address / host names for internal servers.
Create new instance with following parameters:
DNS lookup timeout in secs.
Default: 15 sec.
List of blocked hosts in string, regexp or coderef.
List of white listed hosts in string, regexp or coderef.
DNS resolver object, have same interface as Net::DNS::Resolver.
Resolve a host name using DNS. If it's bad host, then returns $addrs as undef, and $err is the reason in string.
$start_time is a time to start your operation. Timeout value was counted from it. Default value is time().
$timeout is a timeout value. Default value is $dns-timeout>.
$dns-
You can use Net::DNS::Paranoid with Furl!
use Furl::HTTP; use Net::DNS::Paranoid; my $resolver = Net::DNS::Paranoid->new(); my $furl = Furl->new( inet_aton => sub { my ($host, $errmsg) = $resolver->resolve($_[0], time(), $_[1]); die $errmsg unless $host; Socket::inet_aton($host->[0]); } );
I shipped LWPx::ParanoidHandler to wrap this module. Please use it.
Most of code was taken from LWPx::ParanoidAgent.
Tokuhiro Matsuno < tokuhirom @A gmail DOT. com>
Copyright (C) Tokuhiro Matsuno
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Net::DNS::Paranoid, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::DNS::Paranoid
CPAN shell
perl -MCPAN -e shell install Net::DNS::Paranoid
For more information on module installation, please visit the detailed CPAN module installation guide.