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