1N/A#!./perl
1N/A
1N/ABEGIN {
1N/A chdir 't' if -d 't';
1N/A @INC = '../lib';
1N/A}
1N/A
1N/ABEGIN {
1N/A our $hasne;
1N/A eval { my @n = getnetbyname "loopback" };
1N/A $hasne = 1 unless $@ && $@ =~ /unimplemented|unsupported/i;
1N/A unless ($hasne) { print "1..0 # Skip: no getnetbyname\n"; exit 0 }
1N/A use Config;
1N/A $hasne = 0 unless $Config{'i_netdb'} eq 'define';
1N/A unless ($hasne) { print "1..0 # Skip: no netdb.h\n"; exit 0 }
1N/A}
1N/A
1N/ABEGIN {
1N/A our @netent = getnetbyname "loopback"; # This is the function getnetbyname.
1N/A unless (@netent) { print "1..0 # Skip: no loopback net\n"; exit 0 }
1N/A}
1N/A
1N/Aprint "1..2\n";
1N/A
1N/Ause Net::netent;
1N/A
1N/Aprint "ok 1\n";
1N/A
1N/Amy $netent = getnetbyname "loopback"; # This is the OO getnetbyname.
1N/A
1N/Aprint "not " unless $netent->name eq $netent[0];
1N/Aprint "ok 2\n";
1N/A
1N/A# Testing pretty much anything else is unportable;
1N/A# e.g. the canonical name of the "loopback" net may be "loop".
1N/A