| Line | |
|---|
| 1 | #!./perl -w
|
|---|
| 2 |
|
|---|
| 3 | BEGIN {
|
|---|
| 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 |
|
|---|
| 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 |
|
|---|
| 24 | print "1..2\n";
|
|---|
| 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 | }
|
|---|
| 34 |
|
|---|
| 35 | # This checks thats hostanme does not overwrite $_
|
|---|
| 36 | my @domain = qw(foo.example.com bar.example.jp);
|
|---|
| 37 | my @copy = @domain;
|
|---|
| 38 |
|
|---|
| 39 | my @dummy = grep { defined hostname() and hostname() eq $_ } @domain;
|
|---|
| 40 |
|
|---|
| 41 | ($domain[0] && $domain[0] eq $copy[0])
|
|---|
| 42 | ? print "ok 2\n"
|
|---|
| 43 | : print "not ok 2\n";
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.