1Mango::BSON::Binary(3)User Contributed Perl DocumentationMango::BSON::Binary(3)
2
3
4

NAME

6       Mango::BSON::Binary - Binary type
7

SYNOPSIS

9         use Mango::BSON::Binary;
10
11         my $bin = Mango::BSON::Binary->new(data => $bytes, type => 'generic');
12         say $bin->data;
13

DESCRIPTION

15       Mango::BSON::Binary is a container for the BSON binary type used by
16       Mango::BSON. For "JSON" implementations like Mojo::JSON, that support
17       the "TO_JSON" method, it will automatically "Base64" encode the binary
18       data.
19

ATTRIBUTES

21       Mango::BSON::Binary implements the following attributes.
22
23   data
24         my $bytes = $bin->data;
25         $bin      = $bin->data($bytes);
26
27       Binary data.
28
29   type
30         my $type = $bin->type;
31         $bin     = $bin->type('generic');
32
33       Binary subtype.
34

METHODS

36       Mango::BSON::Binary inherits all methods from Mojo::Base and implements
37       the following new ones.
38
39   TO_JSON
40         my $b64 = $bin->TO_JSON;
41
42       Base64 encode "data".
43

OPERATORS

45       Mango::BSON::Binary overloads the following operators.
46
47   bool
48         my $bool = !!$bin;
49
50       Always true.
51
52   stringify
53         my $str = "$bin";
54
55       Alias for "data".
56

SEE ALSO

58       Mango, Mojolicious::Guides, <http://mojolicio.us>.
59
60
61
62perl v5.34.0                      2021-07-22            Mango::BSON::Binary(3)
Impressum