NetSDS...Convert(3pm)

πŸ“¦
version 1.045 Β· 3 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu questing

πŸ’– NetSDS::Util::Convert β€” the manual page, but make it cute πŸ’–

okay bestie, welcome to NetSDS...Convert(3pm), straight out of the User Contributed Perl Documentation collection. pull up a chair, grab a boba, we're gonna talk about converting data formats. it's giving utility module excellence, fr fr. 🧚✨


✨ NAME ✨

NetSDS::Util::Convert β€” data formats conversion functions πŸŽ€


🌸 SYNOPSIS 🌸

use NetSDS::Util::Convert qw(...);

that's it. that's the whole vibe check. import whatever you need, bestie. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so NetSDS::Util::Convert is a module full of miscelaneous functions (yes, the typo is canon, we don't fix canon πŸ’€). it's your little grab-bag of helpers, and here's what's inside:

  • CLI parameters processing
  • types validation
  • HEX, Base64, URI, BCD encondig
  • UUID processing

like. it does a lot. main character energy for real. πŸ‘‘


πŸ”₯ EXPORTED FUNCTIONS πŸ”₯

here's the lineup, one by one, no skips, no skipsies:

πŸ’œ conv_conv_str_bcd($str) β€” convert string to little-endian BCD

this one converts a string to little-endian BCD encoding, filled with F16 value. that's the whole thing. it's a bop. πŸ“

πŸ’œ conv_chr_hex($char) β€” encode char to hexadecimal string

$hex = conv_chr_hex('a'); # return 61

one char in, one hex out. iconic. ✨

πŸ’œ conv_hex_chr($hex) β€” convert hexadecimal string to character

$chr = conv_hex_chr('4A'); # return 'J'

the reverse situation. still slaying. πŸ’…

πŸ’œ conv_str_hex($str) β€” convert byte string to hexadecimal

$str = 'Want hex dump!';
$hex = conv_hex_str($str);
print "Hex string: " . $hex;

(and yes, bestie, the example literally calls conv_hex_str β€” we copy the manpage verbatim around here, no cap. πŸ™ˆ)

πŸ’œ conv_hex_str($string) β€” convert hex to byte string

$hex = '7A686F7061';
$string = conv_hex_str($hex);
print "String from hex: " . $string;

hex goes in, actual readable string comes out. the glow-up is real. 🌈

πŸ’œ conv_str_base64($str) β€” convert string to Base64

my $b64 = str_base64("Hallo, people!");

πŸ’œ conv_base64_str($b64) β€” convert Base64 to string

my $str = base64_str($base64_string);

base64 round trip, we love to see it. 🫢

πŸ’œ conv_str_uri($str) β€” convert string to URI encoded

Example:

my $uri = str_uri("http://www.google.com/?q=what");

πŸ’œ conv_uri_str($uri) β€” decode URI encoded string

Example:

my $str = uri_str($uri_string);

and that's the whole roster. all of them exported, all of them ready to work. πŸ’–


πŸŽ€ EXAMPLES πŸŽ€

None

literally nothing here bestie, the examples live up in the functions themselves. we make do. 😭


πŸ’€ BUGS πŸ’€

None

zero bugs. not one. we are simply that girl. (do not investigate further, just trust the manpage πŸ™ˆ)


⭐ TODO ⭐

  1. Add other encodings support

that's the whole list. one item. we're manifesting it. ✨


πŸ‘‘ SEE ALSO πŸ‘‘

  • Pod::Usage
  • Data::UUID

go read those too, iykyk. πŸ“š


🌸 AUTHORS 🌸

  • Valentyn Solomko <pere@pere.org.ua>
  • Michael Bochkaryov <misha@rattler.kiev.ua>

thank you for your service, legends. πŸ«‘πŸ’–


and that's a wrap on NetSDS...Convert(3pm), bestie! this lil page was rendered with perl v5.36.0 and dated 2022-11-20 β€” vintage, but she still eats. periodt. πŸ’…βœ¨πŸŽ€

πŸ“¦ where this page comes from