1#!./perl
2
3BEGIN {
4    chdir 't' if -d 't';
5    @INC = '../lib';
6}
7
8BEGIN {
9    our $haspe;
10    eval { my @n = getprotobyname "tcp" };
11    $haspe = 1 unless $@ && $@ =~ /unimplemented|unsupported/i;
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
18BEGIN {
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
23print "1..3\n";
24
25use Net::protoent;
26
27print "ok 1\n";
28
29my $protoent = getprotobyname "tcp"; # This is the OO getprotobyname.
30
31print "not " unless $protoent->name   eq $protoent[0];
32print "ok 2\n";
33
34print "not " unless $protoent->proto  == $protoent[2];
35print "ok 3\n";
36
37# Testing pretty much anything else is unportable.
38
39