fix version::is_strict/is_lax exporting
[p5sagit/p5-mst-13.2.git] / lib / Net / hostent.t
index 0a6a79e..421f19d 100644 (file)
@@ -5,7 +5,7 @@ BEGIN {
     @INC = '../lib';
 }
 
-use Test::More tests => 7;
+use Test::More;
 
 BEGIN {
     require Config; import Config;
@@ -14,29 +14,37 @@ BEGIN {
     {
        plan skip_all => "Test uses Socket, Socket not built";
     }
+    if ($^O eq 'MacOS' || ($^O eq 'irix' && $Config{osvers} == 5)) {
+       plan skip_all => "Test relies on resolution of localhost, fails on $^O ($Config{osvers})";
+    }
 }
 
+use Test::More tests => 7;
 
 BEGIN { use_ok 'Net::hostent' }
 
 # Remind me to add this to Test::More.
-sub BAILOUT {
-    print "Bail Out! @_\n";
-    exit;
+sub DIE {
+    print "# @_\n";
+    exit 1;
 }
 
 # test basic resolution of localhost <-> 127.0.0.1
 use Socket;
 
 my $h = gethost('localhost');
+SKIP: {
+skip "Can't resolve localhost and you don't have /etc/hosts", 6
+    if (!defined($h) && !-e '/etc/hosts');
+
 ok(defined $h,  "gethost('localhost')") ||
-  BAILOUT("Can't continue without working gethost: $!");
+  DIE("Can't continue without working gethost: $!");
 
 is( inet_ntoa($h->addr), "127.0.0.1",   'addr from gethost' );
 
 my $i = gethostbyaddr(inet_aton("127.0.0.1"));
 ok(defined $i,  "gethostbyaddr('127.0.0.1')") || 
-  BAILOUT("Can't continue without working gethostbyaddr: $!");
+  DIE("Can't continue without working gethostbyaddr: $!");
 
 is( inet_ntoa($i->addr), "127.0.0.1",   'addr from gethostbyaddr' );
 
@@ -85,3 +93,4 @@ SKIP: {
         print "# " . $h->name . " " . join (",", @{$h->aliases}) . "\n";
     }
 }
+}