1Sys::Hostname::Long(3)User Contributed Perl DocumentationSys::Hostname::Long(3)
2
3
4
6 Sys::Hostname::Long - Try every conceivable way to get full hostname
7
9 use Sys::Hostname::Long;
10 $host_long = hostname_long;
11
13 How to get the host full name in perl on multiple operating systems
14 (mac, windows, unix* etc)
15
17 This is the SECOND release of this code. It has an improved set of
18 tests and improved interfaces - but it is still often failing to get a
19 full host name. This of course is the reason I wrote the module, it is
20 difficult to get full host names accurately on each system. On some
21 systems (eg: Linux) it is dependent on the order of the entries in
22 /etc/hosts.
23
24 To make it easier to test I have testall.pl to generate an output list
25 of all methods. Thus even if the logic is incorrect, it may be possible
26 to get the full name.
27
28 Attempt via many methods to get the systems full name. The
29 Sys::Hostname class is the best and standard way to get the system
30 hostname. However it is missing the long hostname.
31
32 Special thanks to David Sundstrom and Greg Bacon for the original
33 Sys::Hostname
34
36 This is the original list of platforms tested.
37
38 MacOS Macintosh Classic OK
39 Win32 MS Windows (95,98,nt,2000...)
40 98 OK
41 MacOS X Macintosh 10 OK
42 (other darwin) Probably OK (not tested)
43 Linux Linux UNIX OS OK
44 Sparc OK
45 HPUX H.P. Unix 10? Not Tested
46 Solaris SUN Solaris 7? OK (now)
47 Irix SGI Irix 5? Not Tested
48 FreeBSD FreeBSD OK
49
50 A new list has now been compiled of all the operating systems so that I
51 can individually keep informaiton on their success.
52
53 THIS IS IN NEED OF AN UPDATE AFTER NEXT RELEASE.
54
55 Acorn - Not yet tested
56 AIX - Not yet tested
57 Amiga - Not yet tested
58 Atari - Not yet tested
59 AtheOS - Not yet tested
60 BeOS - Not yet tested
61 BSD - Not yet tested
62 BSD/OS - Not yet tested
63 Compaq - Not yet tested
64 Cygwin - Not yet tested
65 Concurrent - Not yet tested
66 DG/UX - Not yet tested
67 Digital - Not yet tested
68 DEC OSF/1 - Not yet tested
69 Digital UNIX - Not yet tested
70 DYNIX/ptx - Not yet tested
71 EPOC - Not yet tested
72 FreeBSD - Not yet tested
73 Fujitsu-Siemens - Not yet tested
74 Guardian - Not yet tested
75 HP - Not yet tested
76 HP-UX - Not yet tested
77 IBM - Not yet tested
78 IRIX - Not yet tested - 3rd hand information might be ok.
79 Japanese - Not yet tested
80 JPerl - Not yet tested
81 Linux
82 Debian - Not yet tested
83 Gentoo - Not yet tested
84 Mandrake - Not yet tested
85 Red Hat- Not yet tested
86 Slackware - Not yet tested
87 SuSe - Not yet tested
88 Yellowdog - Not yet tested
89 LynxOS - Not yet tested
90 Mac OS - Not yet tested
91 Mac OS X - OK 20040315 (v1.1)
92 MachTen - Not yet tested
93 Minix - Not yet tested
94 MinGW - Not yet tested
95 MiNT - Not yet tested
96 MPE/iX - Not yet tested
97 MS-DOS - Not yet tested
98 MVS - Not yet tested
99 NetBSD - Not yet tested
100 NetWare - Not yet tested
101 NEWS-OS - Not yet tested
102 NextStep - Not yet tested
103 Novell - Not yet tested
104 NonStop - Not yet tested
105 NonStop-UX - Not yet tested
106 OpenBSD - Not yet tested
107 ODT - Not yet tested
108 OpenVMS - Not yet tested
109 Open UNIX - Not yet tested
110 OS/2 - Not yet tested
111 OS/390 - Not yet tested
112 OS/400 - Not yet tested
113 OSF/1 - Not yet tested
114 OSR - Not yet tested
115 Plan 9 - Not yet tested
116 Pocket PC - Not yet tested
117 PowerMAX - Not yet tested
118 Psion - Not yet tested
119 QNX
120 4 - Not yet tested
121 6 (Neutrino) - Not yet tested
122 Reliant UNIX - Not yet tested
123 RISCOS - Not yet tested
124 SCO - Not yet tested
125 SGI - Not yet tested
126 Symbian - Not yet tested
127 Sequent - Not yet tested
128 Siemens - Not yet tested
129 SINIX - Not yet tested
130 Solaris - Not yet tested
131 SONY - Not yet tested
132 Sun - Not yet tested
133 Stratus - Not yet tested
134 Tandem - Not yet tested
135 Tru64 - Not yet tested
136 Ultrix - Not yet tested
137 UNIX - Not yet tested
138 U/WIN - Not yet tested
139 Unixware - Not yet tested
140 VMS - Not yet tested
141 VOS - Not yet tested
142 Windows
143 CE - Not yet tested
144 3.1 - Not yet tested
145 95 - Not yet tested
146 98 - Not yet tested
147 Me - Not yet tested
148 NT - Not yet tested
149 2000 - Not yet tested
150 XP - Not yet tested
151 z/OS - Not yet tested
152
154 Unix
155 Most unix systems have trouble working out the fully quallified domain
156 name as it to be configured somewhere in the system correctly. For
157 example in most linux systems (debian, ?) the fully qualified name
158 should be the first entry next to the ip number in /etc/hosts
159
160 192.168.0.1 fred.somwhere.special fred
161
162 If it is the other way around, it will fail.
163
164 Mac
166 Contributions
167
168 David Dick
169 Graeme Hart
170 Piotr Klaban
171
172 * Extra code from G
173 * Dispatch table
174 * List of all operating systems.
175
176 Solaris * Fall back 2 - TCP with DNS works ok * Also can read
177 /etc/defaultdomain file
178
180 L<Sys::Hostname>
181
183 Scott Penrose <scottp@dd.com.au>
184
186 Copyright (c) 2001,2004,2005 Scott Penrose. All rights reserved. This
187 program is free software; you can redistribute it and/or modify it
188 under the same terms as Perl itself.
189
190
191
192perl v5.12.0 2005-06-25 Sys::Hostname::Long(3)