【发布时间】:2011-06-06 01:01:24
【问题描述】:
如何在 Perl 中获取当前机器的主机名?我正在寻找一种适用于 Linux 和 Windows 的方法。
通过网络搜索,我找到了模块 Sys::Hostname,但是我无法安装它
install Sys::Hostname
Going to read '/home/stivlo/.cpan/Metadata'
Database was generated on Sat, 04 Jun 2011 15:27:16 GMT
Running install for module 'Sys::Hostname'
The most recent version "1.16" of the module "Sys::Hostname"
is part of the perl-5.13.11 distribution. To install that, you need to run
force install Sys::Hostname --or--
install F/FL/FLORA/perl-5.13.11.tar.gz
Running make test
Can't test without successful make
Running make install
Make had returned bad status, install seems impossible
Failed during this command:
FLORA/perl-5.13.11.tar.gz : make NO isa perl
我在 Linux Ubuntu 上的 Perl 版本是 5.10.1,我将在 windows 上使用 Strawberry Perl。
【问题讨论】: