Name
SPVM::MIME::Base64 - Base64 Encoding/Decoding
Description
The MIME::Base64 class of SPVM has methods for Base64 encoding/decoding.
Usage
use MIME::Base64;
my $encoded = MIME::Base64->encode_base64('Aladdin:open sesame');
my $decoded = MIME::Base64->decode_base64($encoded);
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.
The argument $eol is the line-ending sequence to use. It is 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.
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.
Any character not part of the 65-character base64 subset is silently ignored. Characters occurring after a =
padding character are never decoded.
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.
This will return the same value as the length of the returned value of the "encode_base64" method, but should be more efficient.
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.
Exceptions:
$string must be defined. Otherwise an exception is thrown.
Other Modules in This Distribution
See Also
MIME::QuotedPrint - SPVM::MIME::QuotedPrint is a MIME::QuotedPrint porting to SPVM
Repository
Author
Yuki Kimoto (kimoto.yuki@gmail.com)
Contributors
Copyright & License
Copyright (c) 2023 Yuki Kimoto
MIT License