SPVM::MIME::Base64(3)

๐Ÿ“ฆ version 1.003, in alpine 3.24

โœจ SPVM::MIME::Base64 โœจ

Okay bestie, welcome to SPVM::MIME::Base64, coming at you from the User Contributed Perl Documentation section of the SPVM::MIME::Base64(3) manual โ€” yes that's the whole title, we're being thorough ๐Ÿ’…


๐ŸŒธ Name ๐ŸŒธ

SPVM::MIME::Base64 โ€” Base64 Encoding/Decoding. That's it, that's the vibe. ๐ŸŽ€


๐Ÿฆ‹ Description ๐Ÿฆ‹

So the MIME::Base64 class in SPVM has methods for Base64 <https://en.wikipedia.org/wiki/Base64> encoding/decoding. Like, that's literally the whole job and it does it beautifully. ๐Ÿ‘‘


๐Ÿ’– Usage ๐Ÿ’–

Take a look at this icon:

use MIME::Base64;

my $encoded = MIME::Base64->encode_base64('Aladdin:open sesame');
my $decoded = MIME::Base64->decode_base64($encoded);

Encode, decode, slay, repeat. ๐Ÿ”โœจ


๐Ÿงš Class Methods ๐Ÿงš

โญ encode_base64

static method encode_base64 : string ($string : string, $eol : string = undef);

Encodes the string $string to a Base64 string, and returns it. Simple as that, no cap. ๐Ÿซถ

The argument $eol is the line-ending sequence to use. It's optional and defaults to "\n".

The returned encoded string is broken into lines of no more than 76 characters each and it will end with $eol unless it is empty.

Pass an empty string as the $eol if you do not want the encoded string to be broken into lines. (No line breaks, no drama. ๐Ÿ’€)

Exceptions:

$string must be defined. Otherwise an exception is thrown. ๐Ÿšจ

โญ decode_base64

static method decode_base64 : string ($string : string);

Decodes a Base64 string $string to a string, and returns it. The reverse glow-up, honestly. ๐Ÿ”ฅ

Any character not part of the 65-character base64 subset is silently ignored. Characters occurring after a "=" padding character are never decoded. (Yeah, everything past the padding is giving "not invited to the party" ๐Ÿ™ˆ)

Exceptions:

$string must be defined. Otherwise an exception is thrown. ๐Ÿšจ

โญ encoded_base64_length

static method encoded_base64_length : int ($string : string, $eol : string = undef);

Returns the length that the encoded string would have without actually encoding it. Math, but make it effortless. ๐Ÿงฎโœจ

This will return the same value as the length of the returned value of the "encode_base64" method, but should be more efficient. Efficiency is so main character energy. ๐Ÿ‘‘

Exceptions:

$string must be defined. Otherwise an exception is thrown. ๐Ÿšจ

โญ decoded_base64_length

static method decoded_base64_length : int ($string : string);

Returns the length that the decoded string would have without actually decoding it.

This will return the same value as the length of the returned value of the "decode_base64" method, but should be more efficient. Again โ€” all the answers, none of the work. ๐Ÿ’…

Exceptions:

$string must be defined. Otherwise an exception is thrown. ๐Ÿšจ


๐ŸŒˆ Other Modules in This Distribution ๐ŸŒˆ

  • SPVM::MIME::QuotedPrint โ€” the sibling module, we love a family moment ๐Ÿซถ

๐Ÿ’œ See Also ๐Ÿ’œ

  • MIME::QuotedPrint โ€” SPVM::MIME::QuotedPrint is a MIME::QuotedPrint porting to SPVM

๐Ÿ“ Repository ๐Ÿ“

SPVM::MIME::Base64 โ€” Github <https://github.com/yuki-kimoto/SPVM-MIME-Base64>


๐ŸŽ€ Author ๐ŸŽ€

Yuki Kimoto (kimoto.yuki@gmail.com)


๐Ÿ‘‘ Contributors ๐Ÿ‘‘

Yoshiyuki Ito <https://github.com/YoshiyukiItoh>


Copyright (c) 2023 Yuki Kimoto

MIT License


Okay bestie that's the whole page, you ate it up ๐Ÿ’– Go forth and encode responsibly. ๐Ÿฆ‹

perl v5.42.2 ยท 2026-02-03 ยท SPVM::MIME::Base64(3) โ€” mwah, catch you in the next manpage ๐Ÿ’‹โœจ

๐Ÿ“ฆ where this page comes from