has hostname => (
is => 'rw',
- required => 1,
lazy => 1,
default => sub {
my ($self) = @_;
'',
{ flags => AI_NUMERICHOST }
);
- return $self->address
- if $err;
+ if ( $err ) {
+ $self->_log->warn("resolve of hostname failed: $err");
+ return $self->address;
+ }
( $err, my $hostname ) = getnameinfo(
$sockaddr->{addr},
NI_NAMEREQD,
# we are only interested in the hostname, not the servicename
NIx_NOSERV
);
- return $err ? $self->address : $hostname;
+ if ( $err ) {
+ $self->_log->warn("resolve of hostname failed: $err");
+ return $self->address;
+ }
+ return $hostname;
},
);