Line | |
---|
1 | #!./perl
|
---|
2 |
|
---|
3 | BEGIN {
|
---|
4 | chdir 't' if -d 't';
|
---|
5 | @INC = '../lib';
|
---|
6 | }
|
---|
7 |
|
---|
8 | BEGIN {
|
---|
9 | our $hasne;
|
---|
10 | eval { my @n = getnetbyname "loopback" };
|
---|
11 | $hasne = 1 unless $@ && $@ =~ /unimplemented|unsupported/i;
|
---|
12 | unless ($hasne) { print "1..0 # Skip: no getnetbyname\n"; exit 0 }
|
---|
13 | use Config;
|
---|
14 | $hasne = 0 unless $Config{'i_netdb'} eq 'define';
|
---|
15 | unless ($hasne) { print "1..0 # Skip: no netdb.h\n"; exit 0 }
|
---|
16 | }
|
---|
17 |
|
---|
18 | BEGIN {
|
---|
19 | our @netent = getnetbyname "loopback"; # This is the function getnetbyname.
|
---|
20 | unless (@netent) { print "1..0 # Skip: no loopback net\n"; exit 0 }
|
---|
21 | }
|
---|
22 |
|
---|
23 | print "1..2\n";
|
---|
24 |
|
---|
25 | use Net::netent;
|
---|
26 |
|
---|
27 | print "ok 1\n";
|
---|
28 |
|
---|
29 | my $netent = getnetbyname "loopback"; # This is the OO getnetbyname.
|
---|
30 |
|
---|
31 | print "not " unless $netent->name eq $netent[0];
|
---|
32 | print "ok 2\n";
|
---|
33 |
|
---|
34 | # Testing pretty much anything else is unportable;
|
---|
35 | # e.g. the canonical name of the "loopback" net may be "loop".
|
---|
36 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.