source: trunk/essentials/dev-lang/perl/lib/Net/t/hostname.t@ 3298

Last change on this file since 3298 was 3181, checked in by bird, 19 years ago

perl 5.8.8

File size: 847 bytes
Line 
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 checks thats hostanme does not overwrite $_
36my @domain = qw(foo.example.com bar.example.jp);
37my @copy = @domain;
38
39my @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.