source: vendor/perl/5.8.8/lib/Net/netent.t

Last change on this file was 3181, checked in by bird, 18 years ago

perl 5.8.8

File size: 879 bytes
Line 
1#!./perl
2
3BEGIN {
4 chdir 't' if -d 't';
5 @INC = '../lib';
6}
7
8BEGIN {
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
18BEGIN {
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
23print "1..2\n";
24
25use Net::netent;
26
27print "ok 1\n";
28
29my $netent = getnetbyname "loopback"; # This is the OO getnetbyname.
30
31print "not " unless $netent->name eq $netent[0];
32print "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.