Net::protoent



Net::protoent

NAME
SYNOPSIS
DESCRIPTION
NOTE
AUTHOR

NAME

Net::protoent − by−name interface to Perl’s built−in getproto*() functions

SYNOPSIS

 use Net::protoent;
 $p = getprotobyname(shift || 'tcp') || die "no proto";
 printf "proto for %s is %d, aliases are %s\n",
    $p−>name, $p−>proto, "@{$p−>aliases}";
 use Net::protoent qw(:FIELDS);
 getprotobyname(shift || 'tcp') || die "no proto";
 print "proto for $p_name is $p_proto, aliases are @p_aliases\n";

DESCRIPTION

This module’s default exports override the core getprotoent(), getprotobyname(), and getnetbyport() functions, replacing them with versions that return "Net::protoent" objects. They take default second arguments of "tcp". This object has methods that return the similarly named structure field name from the C’s protoent structure from netdb.h; namely name, aliases, and proto. The aliases method returns an array reference, the rest scalars.

You may also import all the structure fields directly into your namespace as regular variables using the :FIELDS import tag. (Note that this still overrides your core functions.) Access these fields as variables named with a preceding "p_". Thus, "$proto_obj−>name()" corresponds to $p_name if you import the fields. Array references are available as regular array variables, so for example "@{ $proto_obj−>aliases() }" would be simply @p_aliases.

The getproto() function is a simple front-end that forwards a numeric argument to getprotobyport(), and the rest to getprotobyname().

To access this functionality without the core overrides, pass the "use" an empty import list, and then access function functions with their full qualified names. On the other hand, the built-ins are still available via the "CORE::" pseudo-package.

NOTE

While this class is currently implemented using the Class::Struct module to build a struct-like class, you shouldn’t rely upon this.

AUTHOR

Tom Christiansen



More Linux Commands

manpages/toc2cue.1.html
toc2cue(1) - converts a TOC files of cdrdao(1) into a .cue f
toc2cue converts a TOC file of cdrdao(1) into a .cue file. Please note that the resulting cue file is only valid if the toc-file was created with cdrdao(1) usin

manpages/rpc.5.html
rpc(5) - RPC program number data base - Linux manual page...
The rpc file contains user readable names that can be used in place of RPC program numbers. Each line has the following information: name of server for the RPC

manpages/koi8rxterm.1.html
koi8rxterm(1) - X terminal emulator for KOI8-R environments
koi8rxterm is a wrapper around the xterm(1) program that invokes the latter program with the KOI8RXTerm X resource class set. All arguments to koi8rxterm are pa

manpages/gnutls_x509_dn_deinit.3.html
gnutls_x509_dn_deinit(3) - API function - Linux manual page
This function deallocates the DN object as returned by gnutls_x509_dn_import(). SINCE 2.4.0 REPORTING BUGS Report bugs to <bug-gnutls@gnu.org>. GnuTLS home page

manpages/fsync.1.html
fsync(1) - synchronize the specified file with storage devic
fsync synchronize the in-core state of the specified file with the storage device BUGS The fsync program uses the fsync(2) function and therefore shows the same

manpages/Tk_SetWindowBorderPixmap.3.html
Tk_SetWindowBorderPixmap(3) - change window configuration or
These procedures are analogous to the X library procedures with similar names, such as XConfigureWindow. Each one of the above procedures calls the correspondin

manpages/xzegrep.1.html
xzegrep(1) - search compressed files for a regular expressio
xzegrep.1 - xzgrep invokes grep(1) on files which may be either uncompressed or compressed with xz(1), lzma(1), gzip(1), or bzip2(1). All options specified are

manpages/gnutls_hash_get_len.3.html
gnutls_hash_get_len(3) - API function - Linux manual page...
This function will return the length of the output data of the given hash algorithm. RETURNS The length or zero on error. SINCE 2.10.0 REPORTING BUGS Report bug

manpages/tificc.1.html
tificc(1) little cms ICC profile applier for TIFF...........
tificc.1 - lcms is a standalone CMM engine, which deals with the color management. It implements a fast transformation between ICC profiles. tifficc is little c

manpages/pnmhisteq.1.html
pnmhisteq(1) - histogram equalize a PNM image (Man Page)....
This program is part of Netpbm(1) pnmhisteq increases the contrast of a PGM or PPM image through the technique of histogram equalization.[1] pnmhisteq computes

manpages/ao_string_tokenize.3.html
ao_string_tokenize(3) tokenize an input string (Man Page)...
This function will convert one input string into a list of strings. The list of strings is derived by separating the input based on white space separation. Howe

manpages/scalblnf.3.html
scalblnf(3) - multiply floating-point number by integral pow
These functions multiply their first argument x by FLT_RADIX (probably 2) to the power of exp, that is: x * FLT_RADIX ** exp The definition of FLT_RADIX can be





We can't live, work or learn in freedom unless the software we use is free.