NetAddr::IP::InetBase(3) User Contributed Perl Documentation NetAddr::IP::InetBase(3)

NetAddr::IP::InetBase -- IPv4 and IPV6 utilities

  use NetAddr::IP::Base qw(
        :upper
        inet_aton
        inet_ntoa
        ipv6_aton
        ipv6_ntoa
        ipv6_n2x
        ipv6_n2d
        inet_any2n
        inet_n2dx
        inet_n2ad
        inet_pton
        inet_ntop
        packzeros
        isIPv4
        isNewIPv4
        isAnyIPv4
        AF_INET
        AF_INET6
        fake_AF_INET6
        fillIPv4
  );
  use NetAddr::IP::Util qw(:all :inet :ipv4 :ipv6 :math)
  :ipv4   =>    inet_aton, inet_ntoa, fillIPv4
  :ipv6   =>    ipv6_aton, ipv6_ntoa,ipv6_n2x, ipv6_n2d,
                inet_any2n, inet_n2dx, inet_n2ad
                inet_pton, inet_ntop, packzeros
  $dotquad = inet_ntoa($netaddr);
  $netaddr = inet_aton($dotquad);
  $ipv6naddr = ipv6_aton($ipv6_text);
  $ipv6_text = ipv6_ntoa($ipv6naddr);
  $hex_text = ipv6_n2x($ipv6naddr);
  $dec_text = ipv6_n2d($ipv6naddr);
  $ipv6naddr = inet_any2n($dotquad or $ipv6_text);
  $dotquad or $hex_text = inet_n2dx($ipv6naddr);
  $dotquad or $dec_text = inet_n2ad($ipv6naddr);
  $netaddr = inet_pton($AF_family,$text_addr);
  $text_addr = inet_ntop($AF_family,$netaddr);
  $hex_text = packzeros($hex_text);
  $rv = isIPv4($bits128);
  $rv = isNewIPv4($bits128);
  $rv = isAnyIPv4($bits128);
  $constant = AF_INET();
  $constant = AF_INET6();
  $trueif   = fake_AF_INET6();
  $ip_filled = fillIPv4($shortIP);
  NetAddr::IP::InetBase::lower();
  NetAddr::IP::InetBase::upper();

Un-tar the distribution in an appropriate directory and type:

        perl Makefile.PL
        make
        make test
        make install

NetAddr::IP::InetBase provides a suite network of conversion functions written in pure Perl for converting both IPv4 and IPv6 addresses to and from network address format and text format.

The IPv6 functions support all rfc1884 formats.

  i.e.  x:x:x:x:x:x:x:x:x
        x:x:x:x:x:x:x:d.d.d.d
        ::x:x:x
        ::x:d.d.d.d
  and so on...

        :upper
        inet_aton
        inet_ntoa
        ipv6_aton
        ipv6_ntoa
        ipv6_n2x
        ipv6_n2d
        inet_any2n
        inet_n2dx
        inet_n2ad
        inet_pton
        inet_ntop
        packzeros
        isIPv4
        isNewIPv4
        isAnyIPv4
        AF_INET
        AF_INET6
        fake_AF_INET6
        fillIPv4

        :all
        :ipv4
        :ipv6
        :upper

Michael Robinton <michael@bizsystems.com>

Copyright 2003 - 2012, Michael Robinton <michael@bizsystems.com>

All rights reserved.

This program is free software; you can redistribute it and/or modify it under the terms of either:

  a) the GNU General Public License as published by the Free
  Software Foundation; either version 2, or (at your option) any
  later version, or
  b) the "Artistic License" which comes with this distribution.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See either the GNU General Public License or the Artistic License for more details.

You should have received a copy of the Artistic License with this distribution, in the file named "Artistic". If not, I'll be glad to provide one.

You should also have received a copy of the GNU General Public License along with this program in the file named "Copying". If not, write to the

        Free Software Foundation, Inc.,
        51 Franklin Street, Fifth Floor
        Boston, MA 02110-1301 USA

or visit their web page on the internet at:

        http://www.gnu.org/copyleft/gpl.html.

Michael Robinton <michael@bizsystems.com>

NetAddr::IP(3), NetAddr::IP::Lite(3), NetAddr::IP::Util(3)

2012-10-02 perl v5.34.0