This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Re: question about retlen in utf8.c:Perl_utf8_to_uv()
[perl5.git] / t / lib / net-hostent.t
CommitLineData
fedf0971
RS
1#!./perl -w
2
3BEGIN {
4 chdir 't' if -d 't';
5 @INC = '../lib';
6}
7
8BEGIN { $| = 1; print "1..5\n"; }
9
10END {print "not ok 1\n" unless $loaded;}
11
12use Net::hostent;
13
14$loaded = 1;
15print "ok 1\n";
16
17# test basic resolution of localhost <-> 127.0.0.1
18use Socket;
19
20my $h = gethost('localhost');
21my $i = gethostbyaddr(inet_aton("127.0.0.1"));
22
23print "not " if inet_ntoa($h->addr) ne "127.0.0.1";
24print "ok 2\n";
25
26print "not " if inet_ntoa($i->addr) ne "127.0.0.1";
27print "ok 3\n";
28
29# need to skip the name comparisons on Win32 because windows will
30# return the name of the machine instead of "localhost" when resolving
31# 127.0.0.1 or even "localhost"
32
33if ($^O eq 'MSWin32') {
34 print "ok $_ # skipped on win32\n" for (4,5);
35} else {
36 print "not " if $h->name ne "localhost";
37 print "ok 4\n";
38
39 print "not " if $i->name ne "localhost";
40 print "ok 5\n";
41}