531 lines
9.9 KiB
HTML
531 lines
9.9 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of Sys::Hostname::Long</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>Sys::Hostname::Long</H1>
|
|
Section: User Contributed Perl Documentation (3pm)<BR>Updated: 2015-05-10<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
Sys::Hostname::Long - Try every conceivable way to get full hostname
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
|
|
|
|
|
|
|
|
<PRE>
|
|
use Sys::Hostname::Long;
|
|
$host_long = hostname_long;
|
|
|
|
</PRE>
|
|
|
|
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
|
|
|
|
How to get the host full name in perl on multiple operating systems (mac,
|
|
windows, unix* etc)
|
|
<A NAME="lbAE"> </A>
|
|
<H2>DISCUSSION</H2>
|
|
|
|
|
|
|
|
This is the <FONT SIZE="-1">SECOND</FONT> release of this code. It has an improved set of tests and
|
|
improved interfaces - but it is still often failing to get a full host name.
|
|
This of course is the reason I wrote the module, it is difficult to get full
|
|
host names accurately on each system. On some systems (eg: Linux) it is
|
|
dependent on the order of the entries in /etc/hosts.
|
|
<P>
|
|
|
|
To make it easier to test I have testall.pl to generate an output list of all
|
|
methods. Thus even if the logic is incorrect, it may be possible to get the
|
|
full name.
|
|
<P>
|
|
|
|
Attempt via many methods to get the systems full name. The Sys::Hostname
|
|
class is the best and standard way to get the system hostname. However it is
|
|
missing the long hostname.
|
|
<P>
|
|
|
|
Special thanks to <B>David Sundstrom</B> and <B>Greg Bacon</B> for the original
|
|
Sys::Hostname
|
|
<A NAME="lbAF"> </A>
|
|
<H2>SUPPORT</H2>
|
|
|
|
|
|
|
|
This is the original list of platforms tested.
|
|
<P>
|
|
|
|
|
|
|
|
<PRE>
|
|
MacOS Macintosh Classic OK
|
|
Win32 MS Windows (95,98,nt,2000...)
|
|
98 OK
|
|
MacOS X Macintosh 10 OK
|
|
(other darwin) Probably OK (not tested)
|
|
Linux Linux UNIX OS OK
|
|
Sparc OK
|
|
HPUX H.P. Unix 10? Not Tested
|
|
Solaris SUN Solaris 7? OK (now)
|
|
Irix SGI Irix 5? Not Tested
|
|
FreeBSD FreeBSD OK
|
|
|
|
</PRE>
|
|
|
|
|
|
<P>
|
|
|
|
A new list has now been compiled of all the operating systems so that I can
|
|
individually keep information on their success.
|
|
<P>
|
|
|
|
<FONT SIZE="-1">THIS IS IN NEED OF AN UPDATE AFTER NEXT RELEASE.</FONT>
|
|
<DL COMPACT>
|
|
<DT id="1">Acorn - Not yet tested<DD>
|
|
|
|
|
|
|
|
<DT id="2"><FONT SIZE="-1">AIX -</FONT> Not yet tested<DD>
|
|
|
|
|
|
<DT id="3">Amiga - Not yet tested<DD>
|
|
|
|
|
|
<DT id="4">Atari - Not yet tested<DD>
|
|
|
|
|
|
<DT id="5">AtheOS - Not yet tested<DD>
|
|
|
|
|
|
<DT id="6">BeOS - Not yet tested<DD>
|
|
|
|
|
|
<DT id="7"><FONT SIZE="-1">BSD -</FONT> Not yet tested<DD>
|
|
|
|
|
|
<DT id="8"><FONT SIZE="-1">BSD/OS -</FONT> Not yet tested<DD>
|
|
|
|
|
|
<DT id="9">Compaq - Not yet tested<DD>
|
|
|
|
|
|
<DT id="10">Cygwin - Not yet tested<DD>
|
|
|
|
|
|
<DT id="11">Concurrent - Not yet tested<DD>
|
|
|
|
|
|
<DT id="12"><FONT SIZE="-1">DG/UX -</FONT> Not yet tested<DD>
|
|
|
|
|
|
<DT id="13">Digital - Not yet tested<DD>
|
|
|
|
|
|
<DT id="14"><FONT SIZE="-1">DEC OSF/1 -</FONT> Not yet tested<DD>
|
|
|
|
|
|
<DT id="15">Digital <FONT SIZE="-1">UNIX -</FONT> Not yet tested<DD>
|
|
|
|
|
|
<DT id="16">DYNIX/ptx - Not yet tested<DD>
|
|
|
|
|
|
<DT id="17"><FONT SIZE="-1">EPOC -</FONT> Not yet tested<DD>
|
|
|
|
|
|
<DT id="18">FreeBSD - Not yet tested<DD>
|
|
|
|
|
|
<DT id="19">Fujitsu-Siemens - Not yet tested<DD>
|
|
|
|
|
|
<DT id="20">Guardian - Not yet tested<DD>
|
|
|
|
|
|
<DT id="21"><FONT SIZE="-1">HP -</FONT> Not yet tested<DD>
|
|
|
|
|
|
<DT id="22">HP-UX - Not yet tested<DD>
|
|
|
|
|
|
<DT id="23"><FONT SIZE="-1">IBM -</FONT> Not yet tested<DD>
|
|
|
|
|
|
<DT id="24"><FONT SIZE="-1">IRIX -</FONT> Not yet tested - 3rd hand information might be ok.<DD>
|
|
|
|
|
|
<DT id="25">Japanese - Not yet tested<DD>
|
|
|
|
|
|
<DT id="26">JPerl - Not yet tested<DD>
|
|
|
|
|
|
<DT id="27">Linux<DD>
|
|
|
|
|
|
<DL COMPACT><DT id="28"><DD>
|
|
<DL COMPACT>
|
|
<DT id="29">Debian - Not yet tested<DD>
|
|
|
|
|
|
<DT id="30">Gentoo - Not yet tested<DD>
|
|
|
|
|
|
<DT id="31">Mandrake - Not yet tested<DD>
|
|
|
|
|
|
<DT id="32">Red Hat- Not yet tested<DD>
|
|
|
|
|
|
<DT id="33">Slackware - Not yet tested<DD>
|
|
|
|
|
|
<DT id="34">SuSe - Not yet tested<DD>
|
|
|
|
|
|
<DT id="35">Yellowdog - Not yet tested<DD>
|
|
|
|
|
|
</DL>
|
|
</DL>
|
|
|
|
<DL COMPACT><DT id="36"><DD>
|
|
</DL>
|
|
|
|
<DT id="37">LynxOS - Not yet tested<DD>
|
|
|
|
|
|
<DT id="38">Mac <FONT SIZE="-1">OS -</FONT> Not yet tested<DD>
|
|
|
|
|
|
<DT id="39">Mac <FONT SIZE="-1">OS X - OK 20040315 </FONT>(v1.1)<DD>
|
|
|
|
|
|
<DT id="40">MachTen - Not yet tested<DD>
|
|
|
|
|
|
<DT id="41">Minix - Not yet tested<DD>
|
|
|
|
|
|
<DT id="42">MinGW - Not yet tested<DD>
|
|
|
|
|
|
<DT id="43">MiNT - Not yet tested<DD>
|
|
|
|
|
|
<DT id="44">MPE/iX - Not yet tested<DD>
|
|
|
|
|
|
<DT id="45">MS-DOS - Not yet tested<DD>
|
|
|
|
|
|
<DT id="46"><FONT SIZE="-1">MVS -</FONT> Not yet tested<DD>
|
|
|
|
|
|
<DT id="47">NetBSD - Not yet tested<DD>
|
|
|
|
|
|
<DT id="48">NetWare - Not yet tested<DD>
|
|
|
|
|
|
<DT id="49">NEWS-OS - Not yet tested<DD>
|
|
|
|
|
|
<DT id="50">NextStep - Not yet tested<DD>
|
|
|
|
|
|
<DT id="51">Novell - Not yet tested<DD>
|
|
|
|
|
|
<DT id="52">NonStop - Not yet tested<DD>
|
|
|
|
|
|
<DT id="53">NonStop-UX - Not yet tested<DD>
|
|
|
|
|
|
<DT id="54">OpenBSD - Not yet tested<DD>
|
|
|
|
|
|
<DT id="55"><FONT SIZE="-1">ODT -</FONT> Not yet tested<DD>
|
|
|
|
|
|
<DT id="56">OpenVMS - Not yet tested<DD>
|
|
|
|
|
|
<DT id="57">Open <FONT SIZE="-1">UNIX -</FONT> Not yet tested<DD>
|
|
|
|
|
|
<DT id="58"><FONT SIZE="-1">OS/2 -</FONT> Not yet tested<DD>
|
|
|
|
|
|
<DT id="59"><FONT SIZE="-1">OS/390 -</FONT> Not yet tested<DD>
|
|
|
|
|
|
<DT id="60"><FONT SIZE="-1">OS/400 -</FONT> Not yet tested<DD>
|
|
|
|
|
|
<DT id="61"><FONT SIZE="-1">OSF/1 -</FONT> Not yet tested<DD>
|
|
|
|
|
|
<DT id="62"><FONT SIZE="-1">OSR -</FONT> Not yet tested<DD>
|
|
|
|
|
|
<DT id="63">Plan 9 - Not yet tested<DD>
|
|
|
|
|
|
<DT id="64">Pocket <FONT SIZE="-1">PC -</FONT> Not yet tested<DD>
|
|
|
|
|
|
<DT id="65">PowerMAX - Not yet tested<DD>
|
|
|
|
|
|
<DT id="66">Psion - Not yet tested<DD>
|
|
|
|
|
|
<DT id="67"><FONT SIZE="-1">QNX</FONT><DD>
|
|
|
|
|
|
<DL COMPACT><DT id="68"><DD>
|
|
<DL COMPACT>
|
|
<DT id="69">4 - Not yet tested<DD>
|
|
|
|
|
|
<DT id="70">6 (Neutrino) - Not yet tested<DD>
|
|
|
|
|
|
</DL>
|
|
</DL>
|
|
|
|
<DL COMPACT><DT id="71"><DD>
|
|
</DL>
|
|
|
|
<DT id="72">Reliant <FONT SIZE="-1">UNIX -</FONT> Not yet tested<DD>
|
|
|
|
|
|
<DT id="73"><FONT SIZE="-1">RISCOS -</FONT> Not yet tested<DD>
|
|
|
|
|
|
<DT id="74"><FONT SIZE="-1">SCO -</FONT> Not yet tested<DD>
|
|
|
|
|
|
<DT id="75"><FONT SIZE="-1">SGI -</FONT> Not yet tested<DD>
|
|
|
|
|
|
<DT id="76">Symbian - Not yet tested<DD>
|
|
|
|
|
|
<DT id="77">Sequent - Not yet tested<DD>
|
|
|
|
|
|
<DT id="78">Siemens - Not yet tested<DD>
|
|
|
|
|
|
<DT id="79"><FONT SIZE="-1">SINIX -</FONT> Not yet tested<DD>
|
|
|
|
|
|
<DT id="80">Solaris - Not yet tested<DD>
|
|
|
|
|
|
<DT id="81"><FONT SIZE="-1">SONY -</FONT> Not yet tested<DD>
|
|
|
|
|
|
<DT id="82">Sun - Not yet tested<DD>
|
|
|
|
|
|
<DT id="83">Stratus - Not yet tested<DD>
|
|
|
|
|
|
<DT id="84">Tandem - Not yet tested<DD>
|
|
|
|
|
|
<DT id="85">Tru64 - Not yet tested<DD>
|
|
|
|
|
|
<DT id="86">Ultrix - Not yet tested<DD>
|
|
|
|
|
|
<DT id="87"><FONT SIZE="-1">UNIX -</FONT> Not yet tested<DD>
|
|
|
|
|
|
<DT id="88">U/WIN - Not yet tested<DD>
|
|
|
|
|
|
<DT id="89">Unixware - Not yet tested<DD>
|
|
|
|
|
|
<DT id="90"><FONT SIZE="-1">VMS -</FONT> Not yet tested<DD>
|
|
|
|
|
|
<DT id="91"><FONT SIZE="-1">VOS -</FONT> Not yet tested<DD>
|
|
|
|
|
|
<DT id="92">Windows<DD>
|
|
|
|
|
|
<DL COMPACT><DT id="93"><DD>
|
|
<DL COMPACT>
|
|
<DT id="94"><FONT SIZE="-1">CE -</FONT> Not yet tested<DD>
|
|
|
|
|
|
<DT id="95">3.1 - Not yet tested<DD>
|
|
|
|
|
|
<DT id="96">95 - Not yet tested<DD>
|
|
|
|
|
|
<DT id="97">98 - Not yet tested<DD>
|
|
|
|
|
|
<DT id="98">Me - Not yet tested<DD>
|
|
|
|
|
|
<DT id="99"><FONT SIZE="-1">NT -</FONT> Not yet tested<DD>
|
|
|
|
|
|
<DT id="100">2000 - Not yet tested<DD>
|
|
|
|
|
|
<DT id="101"><FONT SIZE="-1">XP -</FONT> Not yet tested<DD>
|
|
|
|
|
|
</DL>
|
|
</DL>
|
|
|
|
<DL COMPACT><DT id="102"><DD>
|
|
</DL>
|
|
|
|
<DT id="103">z/OS - Not yet tested<DD>
|
|
|
|
|
|
|
|
</DL>
|
|
<A NAME="lbAG"> </A>
|
|
<H2>KNOWN LIMITATIONS</H2>
|
|
|
|
|
|
|
|
<A NAME="lbAH"> </A>
|
|
<H3>Unix</H3>
|
|
|
|
|
|
|
|
Most unix systems have trouble working out the fully qualified domain name as
|
|
it to be configured somewhere in the system correctly. For example in most
|
|
linux systems (debian, ?) the fully qualified name should be the first entry
|
|
next to the ip number in /etc/hosts
|
|
<P>
|
|
|
|
|
|
|
|
<PRE>
|
|
192.168.0.1 fred.somwhere.special fred
|
|
|
|
</PRE>
|
|
|
|
|
|
<P>
|
|
|
|
If it is the other way around, it will fail.
|
|
<A NAME="lbAI"> </A>
|
|
<H3>Mac</H3>
|
|
|
|
|
|
|
|
<A NAME="lbAJ"> </A>
|
|
<H2>TODO</H2>
|
|
|
|
|
|
|
|
Contributions
|
|
<P>
|
|
|
|
|
|
|
|
<PRE>
|
|
David Dick
|
|
Graeme Hart
|
|
Piotr Klaban
|
|
|
|
* Extra code from G
|
|
* Dispatch table
|
|
* List of all operating systems.
|
|
|
|
</PRE>
|
|
|
|
|
|
<P>
|
|
|
|
Solaris
|
|
<TT> </TT>* Fall back 2 - <FONT SIZE="-1">TCP</FONT> with <FONT SIZE="-1">DNS</FONT> works ok<BR>
|
|
<TT> </TT>* Also can read /etc/defaultdomain file<BR>
|
|
<A NAME="lbAK"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
|
|
|
|
|
|
|
|
<PRE>
|
|
L<Sys::Hostname>
|
|
|
|
</PRE>
|
|
|
|
|
|
<A NAME="lbAL"> </A>
|
|
<H2>AUTHOR</H2>
|
|
|
|
|
|
|
|
Originally by Scott Penrose <<I><A HREF="mailto:scottp@dd.com.au">scottp@dd.com.au</A></I>>
|
|
<P>
|
|
|
|
Contributions: Michiel Beijen <<I><A HREF="mailto:michiel.beijen@gmail.com">michiel.beijen@gmail.com</A></I>>
|
|
<A NAME="lbAM"> </A>
|
|
<H2>COPYRIGHT</H2>
|
|
|
|
|
|
|
|
Copyright (c) 2001,2004,2005,2015 Scott Penrose. All rights reserved.
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the same terms as Perl itself.
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="104"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="105"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="106"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="107"><A HREF="#lbAE">DISCUSSION</A><DD>
|
|
<DT id="108"><A HREF="#lbAF">SUPPORT</A><DD>
|
|
<DT id="109"><A HREF="#lbAG">KNOWN LIMITATIONS</A><DD>
|
|
<DL>
|
|
<DT id="110"><A HREF="#lbAH">Unix</A><DD>
|
|
<DT id="111"><A HREF="#lbAI">Mac</A><DD>
|
|
</DL>
|
|
<DT id="112"><A HREF="#lbAJ">TODO</A><DD>
|
|
<DT id="113"><A HREF="#lbAK">SEE ALSO</A><DD>
|
|
<DT id="114"><A HREF="#lbAL">AUTHOR</A><DD>
|
|
<DT id="115"><A HREF="#lbAM">COPYRIGHT</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:58 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|