Commit | Line | Data |
---|---|---|
1d958aa9 JH |
1 | #!./perl |
2 | ||
3 | BEGIN { | |
4 | chdir 't' if -d 't'; | |
5 | @INC = '../lib'; | |
6 | } | |
7 | ||
8 | BEGIN { | |
9 | our $haspe; | |
10 | eval { my @n = getprotobyname "tcp" }; | |
5cbfe51a | 11 | $haspe = 1 unless $@ && $@ =~ /unimplemented|unsupported/i; |
1d958aa9 JH |
12 | unless ($haspe) { print "1..0 # Skip: no getprotobyname\n"; exit 0 } |
13 | use Config; | |
14 | $haspe = 0 unless $Config{'i_netdb'} eq 'define'; | |
15 | unless ($haspe) { print "1..0 # Skip: no netdb.h\n"; exit 0 } | |
16 | } | |
17 | ||
18 | BEGIN { | |
19 | our @protoent = getprotobyname "tcp"; # This is the function getprotobyname. | |
20 | unless (@protoent) { print "1..0 # Skip: no tcp protocol\n"; exit 0 } | |
21 | } | |
22 | ||
23 | print "1..3\n"; | |
24 | ||
25 | use Net::protoent; | |
26 | ||
27 | print "ok 1\n"; | |
28 | ||
29 | my $protoent = getprotobyname "tcp"; # This is the OO getprotobyname. | |
30 | ||
31 | print "not " unless $protoent->name eq $protoent[0]; | |
32 | print "ok 2\n"; | |
33 | ||
34 | print "not " unless $protoent->proto == $protoent[2]; | |
35 | print "ok 3\n"; | |
36 | ||
37 | # Testing pretty much anything else is unportable. | |
38 |