async_resolver: suppress test warning when
Net::DNS::Async not installed.
This commit is contained in:
parent
38d5523b35
commit
924dbfe5de
@ -63,17 +63,17 @@ sub get_async_resolver {
|
||||
my ( $self, %args ) = @_;
|
||||
return $self->{_async_resolver} if $self->{_async_resolver};
|
||||
|
||||
my $res = Net::DNS::Resolver->new(dnsrch => 0);
|
||||
$res->tcp_timeout(0); # Net::DNS::Async handles its own timeouts
|
||||
$res->tcp_timeout(0);
|
||||
|
||||
my $async_res;
|
||||
eval 'use Net::DNS::Async';
|
||||
if ($@) {
|
||||
warn "Net::DNS::Async failed to load";
|
||||
warn "could not load Net::DNS::Async, is it installed?";
|
||||
return;
|
||||
}
|
||||
|
||||
my $res = Net::DNS::Resolver->new(dnsrch => 0);
|
||||
$res->tcp_timeout(0); # Net::DNS::Async handles its own timeouts
|
||||
$res->tcp_timeout(0);
|
||||
|
||||
$self->{_async_resolver} = Net::DNS::Async->new( %args );
|
||||
$self->{_async_resolver}{Resolver} = $res;
|
||||
return $self->{_async_resolver};
|
||||
|
@ -64,6 +64,8 @@ sub __get_resolver {
|
||||
}
|
||||
|
||||
sub __get_async_resolver {
|
||||
eval 'use Net::DNS::Async';
|
||||
return if ($@);
|
||||
my $res = $base->get_async_resolver() or return;
|
||||
isa_ok( $res, 'Net::DNS::Async', "resolver object, $res");
|
||||
isa_ok( $res->{Resolver}, 'Net::DNS::Resolver', "resolver object, $res");
|
||||
|
Loading…
Reference in New Issue
Block a user