Mango:...:Binary(3pm)
π Mango:...:Binary(3pm) β bestie edition π
okay so you're reading a Perl manual page from the User Contributed Perl Documentation collection, and it's all about Mango::BSON::Binary. pull up a chair, we're doing this together π«Ά
β¨ NAME β¨
Mango::BSON::Binary β it's the Binary type bestie, that's the whole vibe π
π¦ SYNOPSIS π¦
use Mango::BSON::Binary;
my $bin = Mango::BSON::Binary->new(data => $bytes, type => 'generic');
say $bin->data;
look at that. clean. iconic. new with data and type, then you just say the data. periodt π
πΈ DESCRIPTION πΈ
okay so Mango::BSON::Binary is a container for the BSON binary type that Mango::BSON uses. that's its whole job and it does it flawlessly, no notes.
and here's the cute part: for "JSON" implementations like Mojo::JSON that support the "TO_JSON" method, it will automatically "Base64" encode the binary data for you. it's giving β¨effortlessβ¨. you don't even have to ask, it just handles it. obsessed.
π ATTRIBUTES π
Mango::BSON::Binary implements the following attributes. yes, both of them, they're little but they're mighty π
π data
my $bytes = $bin->data;
$bin = $bin->data($bytes);
this is the binary data itself. that's it. that's the attribute. the raw bytes, living their best life.
π type
my $type = $bin->type;
$bin = $bin->type('generic');
this one's the binary subtype. and yeah, 'generic' is right there in the example if you need a default-ish vibe, iykyk.
π₯ METHODS π₯
Mango::BSON::Binary inherits all the methods from Mojo::Base (so it's already stacked before it even starts), and then it implements the following new ones:
β TO_JSON
my $b64 = $bin->TO_JSON;
it Base64 encodes "data". that's the move. that's the entire move. slay π
π OPERATORS π
Mango::BSON::Binary overloads the following operators. yes, it's fancy like that.
π¦ bool
my $bool = !!$bin;
Always true. always. no cap. it doesn't matter what's inside, this thing is truthy forever and ever, amen π
π¦ stringify
my $str = "$bin";
this is literally just an alias for "data". same energy, different syntax. π
π SEE ALSO π
go be nosy, bestie, these are your next tabs:
MangoMojolicious::Guides- <http://mojolicio.us>
π quick vibe check: everything above is exactly what the page says, i just made it cuter. don't come for me.
okay bye ily, this page was brought to you by perl v5.30.3 on 2020-06-05 β yes she's a little vintage but she ate and left no crumbs π«Άβ¨πΈ
π¦ where this page comes from
- debian bookworm: libmango-perl 1.30-2 Β· Artistic-2.0
- debian trixie: libmango-perl 1.30-2 Β· Artistic-2.0
- ubuntu jammy: libmango-perl 1.30-2 Β· Artistic-2.0
- ubuntu noble: libmango-perl 1.30-2 Β· Artistic-2.0
- ubuntu resolute: libmango-perl 1.30-2 Β· Artistic-2.0
- ubuntu stonking: libmango-perl 1.30-2 Β· Artistic-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms