32.35. Net::hostent
This module's default exports override the core
gethostbyname and gethostbyaddr
functions, replacing them with versions that return a
Net::hostent object (or undef on
failure). This object has attribute accessor methods that return the
like-named structure field name from the C library's struct
hostent from netdb.h:
name, aliases,
addrtype, length, or
addr_list. The aliases and
addr_list methods return array references; the rest
return scalars. The addr method is equivalent to
the initial element in the addr_list array
reference. The gethost function is a frontend that
forwards a numeric argument to gethostbyaddr by way
of the Socket::inet_aton
function and the rest to
gethostbyname. As with the other semipragmatic
modules that override list-returning built-ins, if you import the
":FIELDS" tag, you can access scalar or array
package variables by the same names as the method calls by using a
leading "h_". This still overrides your core
functions, though.
![]() Copyright © 2001 O'Reilly & Associates. All rights reserved. |
|