xref: /onnv-gate/usr/src/cmd/perl/5.8.4/distrib/lib/Net/t/hostname.t (revision 0:68f95e015346)
1#!./perl -w
2
3BEGIN {
4    unless (-d 'blib') {
5	chdir 't' if -d 't';
6	@INC = '../lib';
7    }
8    if (!eval "require Socket") {
9	print "1..0 # no Socket\n"; exit 0;
10    }
11    if (ord('A') == 193 && !eval "require Convert::EBCDIC") {
12        print "1..0 # EBCDIC but no Convert::EBCDIC\n"; exit 0;
13    }
14}
15
16use Net::Domain qw(hostname domainname hostdomain);
17use Net::Config;
18
19unless($NetConfig{test_hosts}) {
20    print "1..0\n";
21    exit 0;
22}
23
24print "1..2\n";
25
26$domain = domainname();
27
28if(defined $domain && $domain ne "") {
29 print "ok 1\n";
30}
31else {
32 print "not ok 1\n";
33}
34
35# This check thats hostanme does not overwrite $_
36my @domain = qw(foo.example.com bar.example.jp);
37my @copy = @domain;
38
39my @dummy = grep { hostname eq $_ } @domain;
40
41($domain[0] && $domain[0] eq $copy[0])
42  ? print "ok 2\n"
43  : print "not ok 2\n";
44