The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Zonemaster::Engine::Net::IP - Net::IP::XS Wrapper

SYNOPSIS

Deprecated module. This module will be removed in v2023.2. Use Net::IP::XS instead.

    my $ip = Zonemaster::Engine::Net::IP->new( q{0.0.0.0/8} );

PROCEDURAL INTERFACE

ip_is_ipv4

Check if an IP address is of type 4.

Params

IP address

Returns

1 (yes) or 0 (no)

    ip_is_ipv4($ip) and print "$ip is IPv4";
ip_is_ipv6

Check if an IP address is of type 6.

Params

IP address

Returns

1 (yes) or 0 (no)

    ip_is_ipv6($ip) and print "$ip is IPv6";
Error

Returns the error string corresponding to the last error generated in the module. This is also useful for the OO interface, as if the new() function fails, we cannot call $ip->error() and so we have to use Error().

    warn Error();

METHODS

new

Constructor of object.

ip

Return the IP address (or first IP of the prefix or range) in quad format, as a string.

    print ($ip->ip());
overlaps

Check if two IP ranges/prefixes overlap each other. The value returned by the function should be one of: $IP_PARTIAL_OVERLAP (ranges overlap) $IP_NO_OVERLAP (no overlap) $IP_A_IN_B_OVERLAP (range2 contains range1) $IP_B_IN_A_OVERLAP (range1 contains range2) $IP_IDENTICAL (ranges are identical) undef (problem)

    if ($ip->overlaps($ip2)==$IP_A_IN_B_OVERLAP) {...};
prefix

Return the full prefix (ip+prefix length) in quad (standard) format.

    print ($ip->prefix());
prefixlen

Return the length in bits of the current prefix.

    print ($ip->prefixlen());
print

Print the IP object (IP/Prefix or First - Last)

    print ($ip->print());
reverse_ip

Return the reverse IP for a given IP address (in.addr. format).

    print ($ip->reserve_ip());
short

Return the IP in short format: IPv4 addresses: 194.5/16 IPv6 addresses: ab32:f000::

print ($ip->short());

version

Return the version of the current IP object (4 or 6).

    print ($ip->version());