line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mango::BSON::Document; |
2
|
11
|
|
|
11
|
|
67
|
use Mojo::Base 'Tie::Hash'; |
|
11
|
|
|
|
|
24
|
|
|
11
|
|
|
|
|
64
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
sub DELETE { |
5
|
2
|
|
|
2
|
|
6
|
my ($self, $key) = @_; |
6
|
2
|
100
|
|
|
|
11
|
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
|
|
|
9
|
|
9
|
1
|
|
|
|
|
7
|
return delete $self->[0]{$key}; |
10
|
|
|
|
|
|
|
} |
11
|
|
|
|
|
|
|
|
12
|
110
|
|
|
110
|
|
636
|
sub EXISTS { exists $_[0][0]{$_[1]} } |
13
|
|
|
|
|
|
|
|
14
|
177
|
|
|
177
|
|
4972
|
sub FETCH { $_[0][0]{$_[1]} } |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub FIRSTKEY { |
17
|
124
|
|
|
124
|
|
14471
|
$_[0][2] = 0; |
18
|
124
|
|
|
|
|
205
|
&NEXTKEY; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
281
|
100
|
|
281
|
|
365
|
sub NEXTKEY { $_[0][2] <= $#{$_[0][1]} ? $_[0][1][$_[0][2]++] : undef } |
|
281
|
|
|
|
|
1048
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub STORE { |
24
|
112
|
|
|
112
|
|
240
|
my ($self, $key, $value) = @_; |
25
|
112
|
100
|
|
|
|
261
|
push @{$self->[1]}, $key unless exists $self->[0]{$key}; |
|
111
|
|
|
|
|
272
|
|
26
|
112
|
|
|
|
|
389
|
$self->[0]{$key} = $value; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub TIEHASH { |
30
|
91
|
|
|
91
|
|
263
|
my $self = bless [{}, [], 0], shift; |
31
|
91
|
|
|
|
|
262
|
$self->STORE(shift, shift) while @_; |
32
|
91
|
|
|
|
|
220
|
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 |