Help language development. Donate to The Perl Foundation

Net::netent cpan:ELIZABETH last updated on 2018-05-23
[![Build Status](](


Net::netent - Port of Perl 5's Net::netent


    use Net::netent;

    my $n = getnetbyname("loopback")       or die "bad net";
    printf "%s is %08X\n", $, $;

    use Net::netent qw(:FIELDS);


This module's exports `getnetbyname`, `getnetbyaddrd`, and `getnetent` functions that return `Netr::netent` objects. This object has methods that return the similarly named structure field name from the C's netent structure from netdb.h, stripped of their leading "n_" parts, namely name, aliases, addrtype and net.

You may also import all the structure fields directly into your namespace as regular variables using the :FIELDS import tag. Access these fields as variables named with a preceding n_ in front their method names. Thus, $ corresponds to $n_name if you import the fields.

The `getnet` function is a simple front-end that forwards a numeric argument to `getnetbyaddr` and the rest to `getnetbyname`.


Elizabeth Mattijsen <[email protected]>



Copyright 2018 Elizabeth Mattijsen

