Zonema...Net::IP(3pm)

πŸ“¦
version 4.7.3 Β· 2 versions
, in ubuntu noble

πŸ’– Zonema...Net::IP(3pm) πŸ’–

okay bestie, welcome to Zonemaster::Engine::Net::IP β€” literally just a wrapper around Net::IP::XS πŸŽ€ and yes it's from the User Contributed Perl Documentation corner of the internet, iykyk.


✨ 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. no cap, she's retiring πŸ’…
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. slay.

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. the way she just knows ✨

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(). lowkey a rescue mission fr.

warn Error();

πŸ‘‘ METHODS πŸ‘‘

new 🌈

Constructor of object. main character energy, she builds herself.


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());

and that's the whole page bestie, go forth and parse those IPs 🫢✨

signing off with the deets: this was perl v5.36.0, dated 2023-10-01, filed under Zonema...Net::IP(3pm). iconic, no notes πŸ’œπŸŽ€

πŸ“¦ where this page comes from