about summary refs log tree commit
diff options
context:
space:
mode:
authorGraham Barr <gbarr@pobox.com>1999-02-17 15:15:45 +0000
committerGraham Barr <gbarr@pobox.com>1999-02-17 15:15:45 +0000
commit92419eef0b75bd4aead070a5aa2e3176cac79e00 (patch)
tree8d274f4f74b57f8bb5c342a328fe3ef1f8b3f458
parentb6abda47ba101483f57ea2313b505811bc3f3799 (diff)
downloadperl-libnet-92419eef0b75bd4aead070a5aa2e3176cac79e00.tar.gz
Net::Domain
- set FQDN = IP if host does not have a name

-rw-r--r--Net/Domain.pm5
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   = ();