Sys::Hostname(3p) Perl Programmers Reference Guide Sys::Hostname(3p) #
Sys::Hostname(3p) Perl Programmers Reference Guide Sys::Hostname(3p)
NNAAMMEE #
Sys::Hostname - Try every conceivable way to get hostname
SSYYNNOOPPSSIISS #
use Sys::Hostname;
$host = hostname;
DDEESSCCRRIIPPTTIIOONN #
Attempts several methods of getting the system hostname and then caches
the result. It tries the first available of the C library's
ggeetthhoossttnnaammee(()), "`$Config{aphostname}`", uunnaammee(2),
"syscall(SYS_gethostname)", "`hostname`", "`uname -n`", and the file
_/_c_o_m_/_h_o_s_t. If all that fails it "croak"s.
All NULs, returns, and newlines are removed from the result.
AAUUTTHHOORR #
David Sundstrom <_s_u_n_d_s_@_a_s_i_c_t_e_s_t_._s_c_._t_i_._c_o_m>
Texas Instruments
XS code added by Greg Bacon <_g_b_a_c_o_n_@_c_s_._u_a_h_._e_d_u>
perl v5.36.3 2023-02-15 Sys::Hostname(3p)