about summary refs log tree commit
diff options
context:
space:
mode:
authorGraham Barr <gbarr@pobox.com>2005-12-23 12:16:23 +0000
committerGraham Barr <gbarr@pobox.com>2009-02-24 10:40:47 -0600
commitf63bf8b84f1788eeff73b3c1ad75b593d0ab9c1f (patch)
tree841949206eb58cc7f956524466b19e245a6ee755
parentd61942c7147b80159e82cef5a4c16c67e1bdcfd3 (diff)
downloadperl-libnet-f63bf8b84f1788eeff73b3c1ad75b593d0ab9c1f.tar.gz
Doc update for Net::Domain and additional test from Steve Peters
-rw-r--r--Net/Domain.pm8
-rw-r--r--t/hostname.t19
2 files changed, 23 insertions, 4 deletions
diff --git a/Net/Domain.pm b/Net/Domain.pm
index 40ad2a8..b8b57ab 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.19"; # $Id: //depot/libnet/Net/Domain.pm#21 $
+$VERSION = "2.19_01"; # $Id: //depot/libnet/Net/Domain.pm#21 $
 
 my($host,$domain,$fqdn) = (undef,undef,undef);
 
@@ -299,7 +299,7 @@ Net::Domain - Attempt to evaluate the current host's internet name and domain
 
 =head1 SYNOPSIS
 
-    use Net::Domain qw(hostname hostfqdn hostdomain);
+    use Net::Domain qw(hostname hostfqdn hostdomain domainname);
 
 =head1 DESCRIPTION
 
@@ -314,6 +314,10 @@ Each of the functions will return I<undef> if the FQDN cannot be determined.
 
 Identify and return the FQDN of the current host.
 
+=item domainname ()
+
+An alias for hostfqdn ().
+
 =item hostname ()
 
 Returns the smallest part of the FQDN which can be used to identify the host.
diff --git a/t/hostname.t b/t/hostname.t
index 9db66a9..758d304 100644
--- a/t/hostname.t
+++ b/t/hostname.t
@@ -13,7 +13,7 @@ BEGIN {
     }
 }
 
-use Net::Domain qw(hostname domainname hostdomain);
+use Net::Domain qw(hostname domainname hostdomain hostfqdn);
 use Net::Config;
 
 unless($NetConfig{test_hosts}) {
@@ -21,7 +21,7 @@ unless($NetConfig{test_hosts}) {
     exit 0;
 }
 
-print "1..2\n";
+print "1..5\n";
 
 $domain = domainname();
 
@@ -41,3 +41,18 @@ my @dummy = grep { defined hostname() and hostname() eq $_ } @domain;
 ($domain[0] && $domain[0] eq $copy[0])
   ? print "ok 2\n"
   : print "not ok 2\n";
+
+@dummy = grep { defined hostdomain() and hostdomain() eq $_ } @domain;
+
+($domain[0] && $domain[0] eq $copy[0])
+  ? print "ok 3\n"
+  : print "not ok 3\n";
+
+my $name = hostname();
+my $domain = hostdomain();
+if(defined $domain && defined $name && $name ne "" && $domain ne "") {
+    hostfqdn() eq $name . "." . $domain ? print "ok 4\n" : print "not ok 4\n";
+    domainname() eq $name . "." . $domain ? print "ok 5\n" : print "not ok 5\n";} else {
+    print "ok 4 # SKIP domain not fully defined\n";
+    print "ok 5 # SKIP domain not fully defined\n";
+}