Mango::BSON::Binary - Binary type
use Mango::BSON::Binary; my $bin = Mango::BSON::Binary->new(data => $bytes, type => 'generic'); say $bin->data;
Mango::BSON::Binary is a container for the BSON binary type used by Mango::BSON. For JSON implementations like Mojo::JSON, that support the TO_JSON method, it will automatically Base64 encode the binary data.
JSON
TO_JSON
Base64
Mango::BSON::Binary implements the following attributes.
my $bytes = $bin->data; $bin = $bin->data($bytes);
Binary data.
my $type = $bin->type; $bin = $bin->type('generic');
Binary subtype.
Mango::BSON::Binary inherits all methods from Mojo::Base and implements the following new ones.
my $b64 = $bin->TO_JSON;
Base64 encode "data".
Mango::BSON::Binary overloads the following operators.
my $bool = !!$bin;
Always true.
my $str = "$bin";
Alias for "data".
Mango, Mojolicious::Guides, http://mojolicio.us.
To install Mango, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mango
CPAN shell
perl -MCPAN -e shell install Mango
For more information on module installation, please visit the detailed CPAN module installation guide.