Perl in a Nutshell

Perl in a NutshellSearch this book
Previous: 8.109 NDBM_FileChapter 8
Standard Modules
Next: 8.111 Net::netent
 

8.110 Net::hostent

Overrides the core gethostbyname and gethostbyaddr functions with object-oriented versions that return Net::hostent objects. The objects have methods that return the fields of the same name from the hostent structure in netdb.h:

FieldDescription
addr

Address of host, for backwards compatibility

addr_list

List of addresses returned from name server

addrtypeHost address type
aliasesList of aliases
lengthLength of address
nameName of host

You can access the structure fields either with the methods or by importing the fields into your namespace with the :FIELDS import tag and then accessing them by prepending h_ to the field name:

$host_obj->name()
$h_name
Net::hostent exports the following:


Previous: 8.109 NDBM_FilePerl in a NutshellNext: 8.111 Net::netent
8.109 NDBM_FileBook Index8.111 Net::netent