1Sys::Hostname(3pm) Perl Programmers Reference Guide Sys::Hostname(3pm)
2
3
4
6 Sys::Hostname - Try every conceivable way to get hostname
7
9 use Sys::Hostname;
10 $host = hostname;
11
13 Attempts several methods of getting the system hostname and then caches
14 the result. It tries the first available of the C library's
15 gethostname(), "`$Config{aphostname}`", uname(2),
16 "syscall(SYS_gethostname)", "`hostname`", "`uname -n`", and the file
17 /com/host. If all that fails it "croak"s.
18
19 All NULs, returns, and newlines are removed from the result.
20
22 David Sundstrom <sunds@asictest.sc.ti.com>
23
24 Texas Instruments
25
26 XS code added by Greg Bacon <gbacon@cs.uah.edu>
27
28
29
30perl v5.36.0 2022-08-30 Sys::Hostname(3pm)