- 论坛徽章:
- 0
|
原帖由 笑面狐 于 2006-8-31 15:52 发表
用perl获取本机ip很难?
Hi,
how can one answer your "uncool" question?
I can answer your question with "不难" and "难":
不难!
when you are already familiar with system network administration,
using perl to call system's programm and process its return data,
such as: /sbin/ifconfig eth0, or
cat /etc/network/interfaces, or
cat /etc/hosts, or cat /etc/hostname, ... etc.
when hostname is registed in DNS or your network, you can use
CPAN modules: suchas Net::Domain, Net::hostent, Net::Ping, Socket, ...etc.
here is some demo code: for late to demonstration if possiblw.
难!
when not familiar with both above and your localhost's ip assigned as DHCP!
regards, ulmer |
|