This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Sync with libnet-1.12
[perl5.git] / lib / Net / Domain.pm
index bd57996..b79ec8f 100644 (file)
@@ -16,7 +16,7 @@ use Net::Config;
 @ISA = qw(Exporter);
 @EXPORT_OK = qw(hostname hostdomain hostfqdn domainname);
 
-$VERSION = "2.14"; # $Id: //depot/libnet/Net/Domain.pm#15 $
+$VERSION = "2.17"; # $Id: //depot/libnet/Net/Domain.pm#19 $
 
 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");
 
@@ -165,7 +165,7 @@ sub _hostdomain {
         };
 
        chop($dom = `domainname 2>/dev/null`)
-               unless(defined $dom || $^O eq 'MSWin32');
+               unless(defined $dom || $^O =~ /^(?:cygwin|MSWin32)/);
 
        if(defined $dom) {
            my @h = ();
@@ -224,11 +224,11 @@ sub domainname {
     # eleminate DNS lookups
 
     return $fqdn = $host . "." . $domain
-       if(defined $host && defined $domain &&
-          $host !~ /\./ && $domain =~ /\./);
+       if(defined $host and defined $domain
+               and $host !~ /\./ and $domain =~ /\./);
 
     # For hosts that have no name, just an IP address
-    return $fqdn = $host if defined $host && $host =~ /^\d+(\.\d+){3}$/;
+    return $fqdn = $host if defined $host and $host =~ /^\d+(\.\d+){3}$/;
 
     my @host   = defined $host   ? split(/\./, $host)   : ('localhost');
     my @domain = defined $domain ? split(/\./, $domain) : ();
@@ -331,6 +331,6 @@ it under the same terms as Perl itself.
 
 =for html <hr>
 
-I<$Id: //depot/libnet/Net/Domain.pm#15 $>
+I<$Id: //depot/libnet/Net/Domain.pm#19 $>
 
 =cut