Mango::BSON::Binary - Binary type
Contents
Attributes
Mango::BSON::Binary implements the following attributes.
data
my $bytes = $bin->data;
$bin = $bin->data($bytes);
Binary data.
type
my $type = $bin->type;
$bin = $bin->type('generic');
Binary subtype.
Description
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.
Methods
Mango::BSON::Binary inherits all methods from Mojo::Base and implements the following new ones.
TO_JSON
my $b64 = $bin->TO_JSON;
Base64 encode "data".
Name
Mango::BSON::Binary - Binary type
Operators
Mango::BSON::Binary overloads the following operators.
bool
my $bool = !!$bin;
Always true.
stringify
my $str = "$bin";
Alias for "data".
See Also
Mango, Mojolicious::Guides, <http://mojolicio.us>.
perl v5.30.3 2020-06-05 Mango::BSON::Binary(3pm)
Synopsis
use Mango::BSON::Binary;
my $bin = Mango::BSON::Binary->new(data => $bytes, type => 'generic');
say $bin->data;
