1 warn "Legacy library @{[(caller(0))[6]]} will be removed from the Perl core distribution in the next major release. Please install it from the CPAN distribution Perl4::CoreLibs. It is being used at @{[(caller)[1]]}, line @{[(caller)[2]]}.\n";
3 # From: asherman@fmrco.com (Aaron Sherman)
5 # This library is no longer being maintained, and is included for backward
6 # compatibility with Perl 4 programs which may require it.
7 # This legacy library is deprecated and will be removed in a future
10 # In particular, this should not be used as an example of modern Perl
11 # programming techniques.
13 # Suggested alternative: Sys::Hostname
17 local(*P,@tmp,$hostname,$_);
18 if (open(P,"hostname 2>&1 |") && (@tmp = <P>) && close(P))
20 chop($hostname = $tmp[$#tmp]);
22 elsif (open(P,"uname -n 2>&1 |") && (@tmp = <P>) && close(P))
24 chop($hostname = $tmp[$#tmp]);
28 die "$0: Cannot get hostname from 'hostname' or 'uname -n'\n";
31 close P; # Just in case we failed in an odd spot....