1#!./perl 2 3BEGIN { 4 require Config; import Config; 5 if ($Config{'extensions'} !~ /\bSys\/Hostname\b/) { 6 print "1..0 # Skip: Sys::Hostname was not built\n"; 7 exit 0; 8 } 9} 10 11use Sys::Hostname; 12 13use Test::More tests => 2; 14 15SKIP: 16{ 17 eval { 18 $host = hostname; 19 }; 20 skip "No hostname available", 1 21 if $@ =~ /Cannot get host name/; 22 isnt($host, undef, "got a hostname"); 23} 24 25{ 26 local $@; 27 eval { hostname("dummy"); }; 28 like($@, 29 qr/hostname\(\) does not accepts arguments \(it used to silently discard any provided\)/, 30 "hostname no longer accepts arguments" 31 ); 32} 33