NetSDS::Util::Convert(3pm)

NetSDS::Util::Convert3pm

Data formats conversion functions

Usage

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

Overview

"NetSDS::Util::Convert" module contains miscelaneous functions.

•

CLI parameters processing

•

types validation

•

HEX, Base64, URI, BCD encondig

•

UUID processing

Exported functions

conv_conv_str_bcd($str) - convert string to little-endian BCD

This function converts string to little-endian BCD encoding filled with F16 value.

conv_chr_hex($char) - encode char to hexadecimal string
        $hex = conv_chr_hex('a'); # return 61
conv_hex_chr($hex) - convert hexadecimal string to character
        $chr = conv_hex_chr('4A'); # return 'J'
conv_str_hex($str) - convert byte string to hexadecimal
        $str = 'Want hex dump!';
        $hex = conv_hex_str($str);
        print "Hex string: " . $hex;
conv_hex_str($string) - convert hex to byte string
        $hex = '7A686F7061';
        $string = conv_hex_str($hex);
        print "String from hex: " . $string;
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);
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);

Examples

None

Todo

1. Add other encodings support

Releases

8 releases since Debian 6.0 (Squeeze); the text changed 5 times.

  1. 6.0
  2. 7
  3. 8
  4. 9
  5. 10–11
  6. 12–13

Bugs

None

Authors

Valentyn Solomko <[email protected]>

Michael Bochkaryov <[email protected]>

From libnetsds-util-perl 1.045-2 in Debian 13 (Trixie). Parsed by carta from the page's man source.