Conver...Armour(3pm)
π Convert::ASCII::Armour β the manual page, but make it cute π
okay so bestie, welcome to Convert::ASCII::Armour(3pm) β¨ it lives in the User Contributed Perl Documentation corner of your system, and it is literally the glow-up your binary data has been waiting for π
β¨ NAME β¨
Convert::ASCII::Armour β turns binary octets into ASCII armoured messages. it's giving "my data went to the spa and came back wearing a little dress" π
πΈ SYNOPSIS πΈ
my $converter = new Convert::ASCII::Armour;
my $message = $converter->armour(
Object => "FOO RECORD",
Headers => {
Table => "FooBar",
Version => "1.23",
},
Content => {
Key => "0x8738FA7382",
Name => "Zoya Hall",
Pic => "....", # gif
},
Compress => 1,
);
print $message;
and like, this is what comes out the other side, no cap:
-----BEGIN COMPRESSED FOO RECORD-----
Version: 1.23
Table: FooBar
eJwzZzA0Z/BNLS5OTE8NycgsVgCiRIVciIAJg6EJg0tiSaqhsYJvYlFy...
XnpOZl5qYlJySmpaekZmVnZObl5+QWFRcUlpWXlFZRWXAk7g6OTs4urm...
Fh4VGaWAR5ehkbGJqZm5hSUeNXWKDsoGcWpaGpq68bba0dWxtTVmDOYM...
NzuZ
=MxpZvjkrv5XyhkVCuXmsBQ==
-----END COMPRESSED FOO RECORD-----
and then the reverse, bestie, the β¨undoβ¨ button:
my $decoded = $converter->unarmour( $message )
|| die $converter->errstr();
π¦ DESCRIPTION π¦
so this module takes hashes of binary octets and turns them into ASCII messages that are safe to send over 6-bit clean transport channels π because sometimes your channel is picky and cannot handle raw bytes, and honestly? mood.
the encoded ASCII resembles PGP's armoured messages, but β and this is the important part, don't let anyone tell you otherwise β it is in no way compatible with PGP π« lowkey important. like, they're cousins at the family reunion, not twins.
π METHODS π
π new()
Constructor. it makes the thing. that's the whole vibe. β¨
π armour()
converts a hash of binary octets into an ASCII encoded message π
the encoded message has 4 parts, and we're listing all of them because every part is a main character:
- head and tail strings that act as identifiers and delimiters
- a cluster of headers at the top of the message
- the Base64 encoded message body
- a Base64 encoded MD5 digest of the message body
armour() takes a hash as its argument, with these keys:
Objectβ an identification string that gets embedded in the head and tail strings. it's the little name tag π·οΈContentβ a hashref holding the binary octets you want encoded. this hash gets serialized, compressed (if you asked for it), and encoded into ASCII withMIME::Base64. the result becomes the body of the encoded message πHeadersβ a hashref holding the ASCII headers that get placed at the top of the encoded message. these are encoded as RFC822 headers π¬Compressβ a boolean that forcesarmour()to compress the message body. squeeze it, bestie π«Ά
π unarmour()
decodes an armoured ASCII message back into the hash that you'd have handed to armour() π the hash contains Content, Object, and Headers.
unarmour() runs several consistency checks, and it returns a non-true value on failure β so yeah, check it, don't just assume it ate π
π errstr()
returns the error message that unarmour() set when it failed. your little diagnostic bestie when things go sideways π
π AUTHOR π
Vipul Ved Prakash, <mail@vipul.net>
π LICENSE π
Copyright (c) 2001, Vipul Ved Prakash. All rights reserved. This code is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
π SEE ALSO π
okay that's the whole page, you ate it, periodt π this little legend is from perl v5.36.0, dated 2022-12-04, and it's filed under Conver...Armour(3pm) β go forth and armour responsibly, bestie π§β¨
π¦ where this page comes from
- debian bookworm: libconvert-ascii-armour-perl 1.4-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libconvert-ascii-armour-perl 1.4-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libconvert-ascii-armour-perl 1.4-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libconvert-ascii-armour-perl 1.4-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libconvert-ascii-armour-perl 1.4-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms