line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mango::BSON::Binary; |
2
|
11
|
|
|
11
|
|
36
|
use Mojo::Base -base; |
|
11
|
|
|
|
|
13
|
|
|
11
|
|
|
|
|
70
|
|
3
|
11
|
|
|
11
|
|
11703
|
use overload bool => sub {1}, '""' => sub { shift->data }, fallback => 1; |
|
11
|
|
|
25
|
|
13141
|
|
|
11
|
|
|
|
|
80
|
|
|
0
|
|
|
|
|
0
|
|
|
25
|
|
|
|
|
843
|
|
4
|
|
|
|
|
|
|
|
5
|
11
|
|
|
11
|
|
6361
|
use Mojo::Util 'b64_encode'; |
|
11
|
|
|
|
|
364217
|
|
|
11
|
|
|
|
|
1494
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
has [qw(data type)]; |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
1
|
39
|
sub TO_JSON { b64_encode shift->data, '' } |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
1; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=encoding utf8 |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 NAME |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
Mango::BSON::Binary - Binary type |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 SYNOPSIS |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
use Mango::BSON::Binary; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
my $bin = Mango::BSON::Binary->new(data => $bytes, type => 'generic'); |
24
|
|
|
|
|
|
|
say $bin->data; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 DESCRIPTION |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
L is a container for the BSON binary type used by |
29
|
|
|
|
|
|
|
L. For C implementations like L, that support |
30
|
|
|
|
|
|
|
the C method, it will automatically C encode the binary data. |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
L implements the following attributes. |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head2 data |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
my $bytes = $bin->data; |
39
|
|
|
|
|
|
|
$bin = $bin->data($bytes); |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
Binary data. |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head2 type |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
my $type = $bin->type; |
46
|
|
|
|
|
|
|
$bin = $bin->type('generic'); |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Binary subtype. |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 METHODS |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
L inherits all methods from L and implements |
53
|
|
|
|
|
|
|
the following new ones. |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head2 TO_JSON |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
my $b64 = $bin->TO_JSON; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
Base64 encode L"data">. |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 OPERATORS |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
L overloads the following operators. |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head2 bool |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
my $bool = !!$bin; |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Always true. |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head2 stringify |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
my $str = "$bin"; |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
Alias for L. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 SEE ALSO |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
L, L, L. |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=cut |