Fsdb::S...rt::IPv6(3)

πŸ“¦
version 3.9 Β· 3 versions
, in epel 9

πŸ’– NAME πŸ’–

Fsdb::Support::IPv6 β€” ipv6-parsing helpers, periodt. πŸ¦‹ This little icon is from the User Contributed Perl Documentation, and she is here to help your bestie not fumble IPv6 strings. No cap.

✨ SYNOPSIS ✨

Okay so first you load her:

use Fsdb::Support::IPv6;

Then the sections below are the whole squad. Each one does one job, and I kept every example exactly as it appeared, bestie. πŸ’…

πŸŽ€ ipv6_zeroize πŸŽ€

$ipv6_zeroized = Fsdb::Support::IPv6::ipv6_zeroize('1:0002:3:4::');
# result is 1:2:3:4:0:0:0:0

Normalize an IPv6 address so it has all hextets present, with no leading zeros. It also treats strings of hex digits without colons as IPv6 prefixes. Slay. ✨

🌸 ipv6_fullhex 🌸

$ipv6_fullhex = Fsdb::Support::IPv6::ipv6_full('1:0002:3:4::');
# result is 0001000200030004000000000000000

Rewrite an IPv6 address as a full, 128-bit, base-16 number. That's the whole vibe. πŸ”₯ The example literally calls Fsdb::Support::IPv6::ipv6_full β€” copy that name exactly, bestie. πŸ’€

πŸ¦‹ ipv6_normalize πŸ¦‹

$ipv6_normal = Fsdb::Support::IPv6::ipv6_normalize('1:0002::7:0:00:8');
# result is 1:2::7:0:0:8

Convert an IPv6 address to IETF normal form. The input maybe has some fields 0 or leading zero, or :: in a non-standard place. Normalize it to remove leading zeros and replace the leftmost, longest run of zeros with ::. Also treats strings of hex digits without colons as IPv6 prefixes. Iconic. πŸ’…

🧚 ip_fullhex_to_normal 🧚

$ip_normal = Fsdb::Support::IPv6::ip_fullhex_to_normal('20010db8000300040005000600070008');
# result is 2001:db8:3:4:5:6:7:8

$ip_normal = Fsdb::Support::IPv6::ip_fullhex_to_normal('c0000201');
# result is 192.0.2.1

Convert an IPv6 address to IETF normal form. The input maybe has some fields 0 or leading zero, or :: in a non-standard place. Normalize it to remove leading zeros and replace the leftmost, longest run of zeros with ::. Also treats strings of hex digits without colons as IPv6 prefixes. Yes, the second example turns into 192.0.2.1 β€” I'm just reporting what the page says, bestie. 🫢

The internal testing helpers are:

  • _test_zero_fill β€” Internal testing.
  • _test_zero_remove β€” Internal testing.
  • _test_fullhex β€” Internal testing.
  • _test_fullhex_to_normal β€” Internal testing.
  • _test_both β€” Internal testing.
  • _test_ipv6 β€” Internal testing.

Sign-off cuteness: this page is from perl v5.32.1, dated 2024-08-02, and it's the Fsdb::S...rt::IPv6(3) manual. Luv u, bye bestie! πŸ«ΆπŸ’–βœ¨

πŸ“¦ where this page comes from