This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
avoid v-strings with require/use
[perl5.git] / lib / Net / netent.t
CommitLineData
cdbd8744
JH
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" };
5cbfe51a 11 $hasne = 1 unless $@ && $@ =~ /unimplemented|unsupported/i;
cdbd8744
JH
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