Upgrade to CPAN-1.83_66.
[p5sagit/p5-mst-13.2.git] / lib / Net / Domain.pm
index 62b9d96..b8b57ab 100644 (file)
@@ -16,7 +16,7 @@ use Net::Config;
 @ISA = qw(Exporter);
 @EXPORT_OK = qw(hostname hostdomain hostfqdn domainname);
 
-$VERSION = "2.16"; # $Id: //depot/libnet/Net/Domain.pm#18 $
+$VERSION = "2.19_01"; # $Id: //depot/libnet/Net/Domain.pm#21 $
 
 my($host,$domain,$fqdn) = (undef,undef,undef);
 
@@ -127,6 +127,7 @@ sub _hostdomain {
     # those on dialup systems.
 
     local *RES;
+    local($_);
 
     if(open(RES,"/etc/resolv.conf")) {
        while(<RES>) {
@@ -143,7 +144,6 @@ sub _hostdomain {
 
     my $host = _hostname();
     my(@hosts);
-    local($_);
 
     @hosts = ($host,"localhost");
 
@@ -164,14 +164,20 @@ sub _hostdomain {
                    : undef;
         };
 
+       if ( $^O eq 'VMS' ) {
+           $dom ||= $ENV{'TCPIP$INET_DOMAIN'}
+                || $ENV{'UCX$INET_DOMAIN'};
+       }
+
        chop($dom = `domainname 2>/dev/null`)
                unless(defined $dom || $^O =~ /^(?:cygwin|MSWin32)/);
 
        if(defined $dom) {
            my @h = ();
+           $dom =~ s/^\.+//;
            while(length($dom)) {
                push(@h, "$host.$dom");
-               $dom =~ s/^[^.]+.//;
+               $dom =~ s/^[^.]+.+// or last;
            }
            unshift(@hosts,@h);
        }
@@ -293,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
 
@@ -308,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.
@@ -331,6 +341,6 @@ it under the same terms as Perl itself.
 
 =for html <hr>
 
-I<$Id: //depot/libnet/Net/Domain.pm#18 $>
+I<$Id: //depot/libnet/Net/Domain.pm#21 $>
 
 =cut