| Use Case | Command | Description |
|---|---|---|
| Get system hostname (cached) | hostname() |
Returns the hostname, caching the result after first call. |
| Force re-evaluation (by resetting cache) | Sys::Hostname::hostname() |
Calling the function again after the first call returns the cached value; to force reβevaluation, one must reset the internal cache (not shown). |
use Sys::Hostname;
$host = hostname;
Attempts several methods of getting the system hostname and then caches the result. It tries the first available of:
gethostname()$Config{aphostname}syscall(SYS_gethostname)hostnameuname -n/com/hostIf all that fails it croaks.
All NULs, returns, and newlines are removed from the result.
David Sundstrom <sunds AT asictest.com>
Texas Instruments
XS code added by Greg Bacon <gbacon AT cs.edu>
Generated by phpman v4.10.0-7-g98e9fd5 · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-09-19 13:20 @216.73.216.42
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)