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