Skip Menu |

This queue is for tickets about the Net-DHCP-Watch CPAN distribution.

Report information
The Basics
Id: 73847
Status: new
Priority: 0/
Queue: Net-DHCP-Watch

People
Owner: Nobody in particular
Requestors: michael-developer [...] fami-braun.de
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Net::DHCP::Watch fails if gethost is not working (v2.03)
Date: Mon, 09 Jan 2012 13:44:14 +0100
To: <bug-Net-DHCP-Watch [...] rt.cpan.org>
From: Michael <michael-developer [...] fami-braun.de>
Hi, I'm using Net::DHCP::Watch and it fails if DNS is unavailable with an error message indicating that ->addr_list cannot be resolved. This is because the following lines fail if gehost returns undef. # test if server hostname given is known (name or IP) $self->{Server} = $params->{server}; unless ( $h = gethost($self->{Server}) ) { carp "Can not resolve: ",$self->{Server}; } # test if client hostname given is known (name or IP) # and keep only the first IP address. $self->{Client} = $params->{client}; unless ( $h = gethost($self->{Client}) ) { carp "Can not resolve: ",$self->{Client}; } $self->{Client} = $h->addr_list->[0]; I propose to replace the code mentioned above by the following text, as this ignores the value of $h iff it is undefined. # test if server hostname given is known (name or IP) $self->{Server} = $params->{server}; unless ( $h = gethost($self->{Server}) ) { carp "Can not resolve: ",$self->{Server}; } else { $self->{Server} = $h->addr_list->[0]; } # test if client hostname given is known (name or IP) # and keep only the first IP address. $self->{Client} = $params->{client}; unless ( $h = gethost($self->{Client}) ) { carp "Can not resolve: ",$self->{Client}; } else { $self->{Client} = $h->addr_list->[0]; } Regards, M. Braun