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
my $h = gethost('localhost');
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' );
unlink $tmpfile;
-open(FOO, ">$tmpfile") || BAILOUT("Can't open temp test file: $!");
+open(FOO, ">$tmpfile") || DIE("Can't open temp test file: $!");
close FOO;
-open(FOO, ">$tmpfile") || BAILOUT("Can't open temp test file: $!");
+open(FOO, ">$tmpfile") || DIE("Can't open temp test file: $!");
my($nlink, $mtime, $ctime) = (stat(FOO))[$NLINK, $MTIME, $CTIME];
SKIP: {
}
# truncate and touch $tmpfile.
-open(F, ">$tmpfile") || BAILOUT("Can't open temp test file: $!");
+open(F, ">$tmpfile") || DIE("Can't open temp test file: $!");
close F;
ok(-z $tmpfile, '-z on empty file');
ok(! -s $tmpfile, ' and -s');
-open(F, ">$tmpfile") || BAILOUT("Can't open temp test file: $!");
+open(F, ">$tmpfile") || DIE("Can't open temp test file: $!");
print F "hi\n";
close F;
SKIP: {
skip "No null device to test with", 1 unless -e $Null;
- open(NULL, $Null) or BAIL_OUT("Can't open $Null: $!");
+ open(NULL, $Null) or DIE("Can't open $Null: $!");
ok(! -t NULL, 'null device is not a TTY');
close(NULL);
}