line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mango::BSON::Document; |
2
|
11
|
|
|
11
|
|
35
|
use Mojo::Base 'Tie::Hash'; |
|
11
|
|
|
|
|
13
|
|
|
11
|
|
|
|
|
43
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
sub DELETE { |
5
|
2
|
|
|
2
|
|
3
|
my ($self, $key) = @_; |
6
|
2
|
100
|
|
|
|
15
|
return undef unless exists $self->[0]{$key}; |
7
|
1
|
|
|
|
|
6
|
$key eq $self->[1][$_] and splice @{$self->[1]}, $_, 1 and last |
8
|
1
|
|
66
|
|
|
2
|
for 0 .. $#{$self->[1]}; |
|
1
|
|
100
|
|
|
9
|
|
9
|
1
|
|
|
|
|
5
|
return delete $self->[0]{$key}; |
10
|
|
|
|
|
|
|
} |
11
|
|
|
|
|
|
|
|
12
|
110
|
|
|
110
|
|
507
|
sub EXISTS { exists $_[0][0]{$_[1]} } |
13
|
|
|
|
|
|
|
|
14
|
177
|
|
|
177
|
|
3448
|
sub FETCH { $_[0][0]{$_[1]} } |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub FIRSTKEY { |
17
|
124
|
|
|
124
|
|
9999
|
$_[0][2] = 0; |
18
|
124
|
|
|
|
|
165
|
&NEXTKEY; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
281
|
100
|
|
281
|
|
200
|
sub NEXTKEY { $_[0][2] <= $#{$_[0][1]} ? $_[0][1][$_[0][2]++] : undef } |
|
281
|
|
|
|
|
830
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub STORE { |
24
|
112
|
|
|
112
|
|
115
|
my ($self, $key, $value) = @_; |
25
|
112
|
100
|
|
|
|
193
|
push @{$self->[1]}, $key unless exists $self->[0]{$key}; |
|
111
|
|
|
|
|
146
|
|
26
|
112
|
|
|
|
|
273
|
$self->[0]{$key} = $value; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub TIEHASH { |
30
|
91
|
|
|
91
|
|
180
|
my $self = bless [{}, [], 0], shift; |
31
|
91
|
|
|
|
|
234
|
$self->STORE(shift, shift) while @_; |
32
|
91
|
|
|
|
|
159
|
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 |