summaryrefslogtreecommitdiff
path: root/lib/Net
diff options
context:
space:
mode:
authorSteve Peters <steve@fisharerojo.org>2005-12-22 03:08:59 +0000
committerSteve Peters <steve@fisharerojo.org>2005-12-22 03:08:59 +0000
commitc20cde702e4f050369a7a98d262b4e65ac3bed28 (patch)
tree438e48ea386e9e0753d86acabae9c4f4589352e7 /lib/Net
parentd41c018a580ac2dafca04b156c937ada656fd14b (diff)
downloadperl-c20cde702e4f050369a7a98d262b4e65ac3bed28.tar.gz
Add documentation for method domainname() in Net::Domain. Add some
additional tests for Net::Domain. Also, since it is tested, remove test case from lib/1_compile.t. One step closer to $500. p4raw-id: //depot/perl@26440
Diffstat (limited to 'lib/Net')
-rw-r--r--lib/Net/Domain.pm8
-rw-r--r--lib/Net/t/hostname.t13
2 files changed, 17 insertions, 4 deletions
diff --git a/lib/Net/Domain.pm b/lib/Net/Domain.pm
index 40ad2a8c9c..b8b57abc1a 100644
--- a/lib/Net/Domain.pm
+++ b/lib/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/lib/Net/t/hostname.t b/lib/Net/t/hostname.t
index 9db66a97cf..7577158199 100644
--- a/lib/Net/t/hostname.t
+++ b/lib/Net/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,12 @@ 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";
+
+hostfqdn() eq hostname() . "." . hostdomain() ? print "ok 4\n" : print "not ok 4\n";
+domainname() eq hostname() . "." . hostdomain() ? print "ok 5\n" : print "not ok 5\n";