README
1NAME
2 Sys::Hostname::FQDN - Get the short or long hostname
3
4SYNOPSIS
5 use Sys::Hostname::FQDN qw(
6 asciihostinfo
7 gethostinfo
8 inet_ntoa
9 inet_aton
10 fqdn
11 short
12 );
13
14 $host = short();
15 $fqdn = fqdn();
16 ($name,$aliases,$addrtype,$length,@addrs)=gethostinfo();
17 ($name,$aliases,$addrtype,$length,@addrs)=asciihostinfo();
18 $dotquad = inet_ntoa($netaddr);
19 $netaddr = inet_aton($dotquad);
20
21INSTALLATION
22 To install this module type the following:
23
24 perl Makefile.PL
25 make
26 make test
27 make install
28
29 Solaris users, see the 'hints' subdirectory if you have problems with
30 the build.
31
32DESCRIPTION
33 Sys::Hostname::FQDN uses the host 'C' library to discover the (usually)
34 short host name, then uses (perl) gethostbyname to extract the real
35 hostname.
36
37 The results from gethostbyname are exported as gethostinfo and
38 asciihostinfo as a convenience since they are available. Similarly, the
39 'C' library functions inet_ntoa and inet_aton are exported.
40
41 $host = short();
42 returns the host part of this host's FQDN.
43
44 $fqdn = fqdn();
45 returns the fully qualified host name of this host.
46
47 ($name,$aliases,$addrtype,$length,@addrs)=gethostinfo();
48 returns:
49 $name fully qualifed host name of this host.
50 $aliases alternate names for this host.
51 $addrtype The type of address; always AF_INET at present.
52 $length The length of the address in bytes.
53 @addrs array of network addresses for this host
54 in network byte order.
55
56 ($name,$aliases,$addrtype,$length,@addrs)=asciihostinfo();
57 returns:
58 $name fully qualifed host name of this host.
59 $aliases alternate names for this host.
60 $addrtype The type of address; always AF_INET at present.
61 $length The length of the address in bytes.
62 @addrs array of dot quad IP addresses for this host.
63
64 $dotquad = inet_ntoa($netaddr);
65 input: packed network address in network byte order.
66 returns: dot quad IP address.
67
68 $netaddr = inet_aton($dotquad);
69 input: dot quad IP address.
70 returns: packed network address in network byte order.
71
72DEPENDENCIES
73 none
74
75EXPORT
76 None by default
77
78EXPORT_OK
79 asciihostinfo
80 gethostinfo
81 inet_ntoa
82 inet_aton
83 fqdn
84 short
85
86AUTHOR
87 Michael Robinton <michael@bizsystems.com>
88
89COPYRIGHT AND LICENCE
90 Copyright 2003, Michael Robinton <michael@bizsystems.com>
91
92 This program is free software; you can redistribute it and/or modify
93 it under the terms of the GNU General Public License as published by
94 the Free Software Foundation; either version 2 of the License, or
95 (at your option) any later version.
96
97 This program is distributed in the hope that it will be useful,
98 but WITHOUT ANY WARRANTY; without even the implied warranty of
99 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
100 GNU General Public License for more details.
101
102 You should have received a copy of the GNU General Public License
103 along with this program; if not, write to the Free Software
104 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
105
106