Scroll to navigation

Zonemaster::Engine::Net::IP(3pm) User Contributed Perl Documentation Zonemaster::Engine::Net::IP(3pm)

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

Check if an IP address is of type 4.
IP address
1 (yes) or 0 (no)

    ip_is_ipv4($ip) and print "$ip is IPv4";
Check if an IP address is of type 6.
IP address
1 (yes) or 0 (no)

    ip_is_ipv6($ip) and print "$ip is IPv6";
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

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

    print ($ip->ip());
    
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) {...};
    
Return the full prefix (ip+prefix length) in quad (standard) format.

    print ($ip->prefix());
    
Return the length in bits of the current prefix.

    print ($ip->prefixlen());
    
Print the IP object (IP/Prefix or First - Last)

    print ($ip->print());
    
Return the reverse IP for a given IP address (in.addr. format).

    print ($ip->reserve_ip());
    
Return the IP in short format: IPv4 addresses: 194.5/16 IPv6 addresses: ab32:f000::

print ($ip->short());

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

    print ($ip->version());
    
2023-10-01 perl v5.36.0