diff options
Diffstat (limited to 'Net/Domain.pm')
-rw-r--r-- | Net/Domain.pm | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Net/Domain.pm b/Net/Domain.pm index 765bfaa..bbd9ced 100644 --- a/Net/Domain.pm +++ b/Net/Domain.pm @@ -16,7 +16,7 @@ use Net::Config; @ISA = qw(Exporter); @EXPORT_OK = qw(hostname hostdomain hostfqdn domainname); -$VERSION = "2.11"; # $Id: //depot/libnet/Net/Domain.pm#9 $ +$VERSION = "2.12"; # $Id: //depot/libnet/Net/Domain.pm#10 $ my($host,$domain,$fqdn) = (undef,undef,undef); @@ -217,6 +217,9 @@ sub domainname { return $fqdn = $host . "." . $domain if($host !~ /\./ && $domain =~ /\./); + # For hosts that have no name, just an IP address + return $fqdn = $host if $host =~ /^\d+(\.\d+){3}$/; + my @host = split(/\./, $host); my @domain = split(/\./, $domain); my @fqdn = (); |