line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mango::BSON::Document; |
2
|
11
|
|
|
11
|
|
37
|
use Mojo::Base 'Tie::Hash'; |
|
11
|
|
|
|
|
13
|
|
|
11
|
|
|
|
|
43
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
sub DELETE { |
5
|
2
|
|
|
2
|
|
4
|
my ($self, $key) = @_; |
6
|
2
|
100
|
|
|
|
17
|
return undef unless exists $self->[0]{$key}; |
7
|
1
|
|
|
|
|
7
|
$key eq $self->[1][$_] and splice @{$self->[1]}, $_, 1 and last |
8
|
1
|
|
66
|
|
|
2
|
for 0 .. $#{$self->[1]}; |
|
1
|
|
100
|
|
|
8
|
|
9
|
1
|
|
|
|
|
5
|
return delete $self->[0]{$key}; |
10
|
|
|
|
|
|
|
} |
11
|
|
|
|
|
|
|
|
12
|
110
|
|
|
110
|
|
533
|
sub EXISTS { exists $_[0][0]{$_[1]} } |
13
|
|
|
|
|
|
|
|
14
|
177
|
|
|
177
|
|
4701
|
sub FETCH { $_[0][0]{$_[1]} } |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub FIRSTKEY { |
17
|
124
|
|
|
124
|
|
10699
|
$_[0][2] = 0; |
18
|
124
|
|
|
|
|
153
|
&NEXTKEY; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
281
|
100
|
|
281
|
|
210
|
sub NEXTKEY { $_[0][2] <= $#{$_[0][1]} ? $_[0][1][$_[0][2]++] : undef } |
|
281
|
|
|
|
|
866
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub STORE { |
24
|
112
|
|
|
112
|
|
118
|
my ($self, $key, $value) = @_; |
25
|
112
|
100
|
|
|
|
206
|
push @{$self->[1]}, $key unless exists $self->[0]{$key}; |
|
111
|
|
|
|
|
163
|
|
26
|
112
|
|
|
|
|
271
|
$self->[0]{$key} = $value; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub TIEHASH { |
30
|
91
|
|
|
91
|
|
187
|
my $self = bless [{}, [], 0], shift; |
31
|
91
|
|
|
|
|
224
|
$self->STORE(shift, shift) while @_; |
32
|
91
|
|
|
|
|
173
|
return $self; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
1; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=encoding utf8 |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 NAME |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
Mango::BSON::Document - Document type |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 SYNOPSIS |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
use Mango::BSON::Document; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
tie my %hash, 'Mango::BSON::Document'; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 DESCRIPTION |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
L is a container for the BSON document type used by |
52
|
|
|
|
|
|
|
L. |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 SEE ALSO |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
L, L, L. |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=cut |