The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
Build.PL 11
Changes 015
LICENSE 11
META.yml 22
Makefile.PL 11
README 22
dist.ini 11
lib/Sys/HostIP.pm 1117
t/base.t 212
9 files changed (This is a version diff) 4042
@@ -24,7 +24,7 @@ my %module_build_args = (
     "Jonathan Schatz <jon\@divisionbyzero.com>"
   ],
   "dist_name" => "Sys-HostIP",
-  "dist_version" => "1.93",
+  "dist_version" => "1.97",
   "license" => "perl",
   "module_name" => "Sys::HostIP",
   "recommends" => {},
@@ -1,5 +1,20 @@
 Revision history for Perl extension Sys::HostIP.
 
+1.97    03.02.13
+        * Adding support for Tru64 UNIX.
+          (Thank you, Robert Urban!)
+
+1.96    25.10.12
+        * No functional changes.
+        * RT #80399: doc typo by Peter Newman.
+
+1.95    23.02.12
+        * Trying to please testers more. (I'm looking at you, Chris!)
+
+1.94    18.02.12
+        * Don't return 127.0.0.1 as default device if it wasn't really found.
+          (tests have verified some machines don't have it)
+
 1.93    14.02.12
         * GH #4: Matthew Musgrove (Mr. Muskrat) unearthed a bug in tests that
           would plan an incorrect number of tests by operating system. Fixed.
@@ -22,7 +22,7 @@ This is free software, licensed under:
                      Version 1, February 1989
 
  Copyright (C) 1989 Free Software Foundation, Inc.
-                    51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ 51 Franklin St, Suite 500, Boston, MA  02110-1335  USA
 
  Everyone is permitted to copy and distribute verbatim copies
  of this license document, but changing it is not allowed.
@@ -14,7 +14,7 @@ configure_requires:
   ExtUtils::MakeMaker: 6.30
   Module::Build: 0.3601
 dynamic_config: 0
-generated_by: 'Dist::Zilla version 4.300002, CPAN::Meta::Converter version 2.112621'
+generated_by: 'Dist::Zilla version 4.300028, CPAN::Meta::Converter version 2.120921'
 license: perl
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -27,4 +27,4 @@ requires:
   strict: 0
   vars: 0
   warnings: 0
-version: 1.93
+version: 1.97
@@ -35,7 +35,7 @@ my %WriteMakefileArgs = (
     "vars" => 0,
     "warnings" => 0
   },
-  "VERSION" => "1.93",
+  "VERSION" => "1.97",
   "test" => {
     "TESTS" => "t/*.t"
   }
@@ -2,7 +2,7 @@ NAME
     Sys::HostIP - Try extra hard to get IP address related info
 
 VERSION
-    version 1.93
+    version 1.97
 
 SYNOPSIS
         use Sys::HostIP;
@@ -62,7 +62,7 @@ METHODS
 
         foreach my $interface ( keys %{$interfaces} ) {
             my $ip = $interfaces->{$interface};
-            print "$interface => $ip"\n";
+            print "$interface => $ip\n";
         }
 
     Returns a hash ref containing all pairs of interfaces and their
@@ -5,7 +5,7 @@ license = Perl_5
 copyright_holder = Sawyer X
 copyright_year   = 2012
 
-version = 1.93
+version = 1.97
 
 [@Basic]
 [PodSyntaxTests]
@@ -2,7 +2,7 @@ use strict;
 use warnings;
 package Sys::HostIP;
 {
-  $Sys::HostIP::VERSION = '1.93';
+  $Sys::HostIP::VERSION = '1.97';
 }
 # ABSTRACT: Try extra hard to get IP address related info
 
@@ -60,15 +60,23 @@ sub ip {
             }
         }
     } else {
+        my $lo_found;
+
         foreach my $key ( sort keys %{$if_info} ) {
             # we don't want the loopback
-            next if ( $if_info->{$key} eq '127.0.0.1' );
+            if ( $if_info->{$key} eq '127.0.0.1' ) {
+                $lo_found++;
+                next;
+            }
+
             # now we return the first one that comes up
             return ( $if_info->{$key} );
         }
 
         # we get here if loopback is the only active device
-        return '127.0.0.1';
+        $lo_found and return '127.0.0.1';
+
+        return;
     }
 }
 
@@ -110,8 +118,10 @@ sub _get_ifconfig_binary {
         $ifconfig =  '/sbin/ifconfig -a';
     } elsif ( $^O eq 'aix' ) {
         $ifconfig = '/usr/sbin/ifconfig -a';
-    } elsif  ( $^O eq 'irix' ) {
+    } elsif ( $^O eq 'irix' ) {
         $ifconfig = '/usr/etc/ifconfig';
+    } elsif ( $^O eq 'dec_osf' ) {
+        $ifconfig = '/sbin/ifconfig';
     } else {
         carp "Unknown system ($^O), guessing ifconfig is in /sbin/ifconfig " .
              "(email xsawyerx\@cpan.org with the location of your ifconfig)\n";
@@ -272,7 +282,7 @@ sub _get_win32_interface_info {
 
 1;
 
-
+__END__
 
 =pod
 
@@ -282,7 +292,7 @@ Sys::HostIP - Try extra hard to get IP address related info
 
 =head1 VERSION
 
-version 1.93
+version 1.97
 
 =head1 SYNOPSIS
 
@@ -349,7 +359,7 @@ Returns an array ref containing all the IP addresses of your machine.
 
     foreach my $interface ( keys %{$interfaces} ) {
         my $ip = $interfaces->{$interface};
-        print "$interface => $ip"\n";
+        print "$interface => $ip\n";
     }
 
 Returns a hash ref containing all pairs of interfaces and their corresponding
@@ -427,7 +437,3 @@ This is free software; you can redistribute it and/or modify it under
 the same terms as the Perl 5 programming language system itself.
 
 =cut
-
-
-__END__
-
@@ -2,7 +2,7 @@
 
 use strict;
 use warnings;
-use Test::More tests => 8;
+use Test::More tests => 6;
 use Sys::HostIP qw/ip ips ifconfig interfaces/;
 use Data::Dumper;
 
@@ -12,6 +12,7 @@ my $hostip = Sys::HostIP->new;
 my $sub_ip   = ip();
 my $class_ip = $hostip->ip;
 
+diag("Class IP: $class_ip");
 ok( $class_ip =~ /^ \d+ (?: \. \d+ ){3} $/x, 'IP by class looks ok' );
 is( $class_ip, $sub_ip, 'IP by class matches IP by sub' );
 
@@ -20,16 +21,6 @@ my $class_ips = $hostip->ips;
 isa_ok( $class_ips, 'ARRAY', 'scalar context ips() gets arrayref' );
 ok( 1 == grep( /^$class_ip$/, @{$class_ips} ), 'Found IP in IPs by class' );
 
-# skipping in case it's MSWin32 or cygwin?
-SKIP: {
-    skip 'Issues on Windows' => 1 if $^O =~ /(MSWin32|cygwin)/;
-    diag(Dumper($class_ips));
-    ok(
-        grep( /^127\.0\.0\.1$/, @{$class_ips} ),
-        'Found 127.0.0.1 in IPs by class',
-    );
-};
-
 # -- interfaces() --
 my $interfaces = $hostip->interfaces;
 isa_ok( $interfaces, 'HASH', 'scalar context interfaces gets hashref' );
@@ -40,13 +31,3 @@ cmp_ok(
     'Matching number of interfaces and ips',
 );
 
-# skipping in case it's MSWin32 or cygwin?
-SKIP: {
-    skip 'Issues on Windows' => 1 if $^O =~ /(MSWin32|cygwin)/;
-    diag(Dumper($interfaces));
-    ok(
-        grep( /^127\.0\.0\.1$/, values %{$interfaces} ),
-        'Found 127.0.0.1 in interfaces',
-    );
-};
-