line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
71
|
|
|
71
|
|
30852
|
use 5.010001; |
|
71
|
|
|
|
|
262
|
|
2
|
71
|
|
|
71
|
|
361
|
use strict; |
|
71
|
|
|
|
|
138
|
|
|
71
|
|
|
|
|
1345
|
|
3
|
71
|
|
|
71
|
|
324
|
use warnings; |
|
71
|
|
|
|
|
127
|
|
|
71
|
|
|
|
|
2167
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package BSON::Doc; |
6
|
|
|
|
|
|
|
# ABSTRACT: BSON type wrapper for ordered documents |
7
|
|
|
|
|
|
|
|
8
|
71
|
|
|
71
|
|
347
|
use version; |
|
71
|
|
|
|
|
135
|
|
|
71
|
|
|
|
|
406
|
|
9
|
|
|
|
|
|
|
our $VERSION = 'v1.12.0'; |
10
|
|
|
|
|
|
|
|
11
|
71
|
|
|
71
|
|
6300
|
use Carp qw/croak/; |
|
71
|
|
|
|
|
162
|
|
|
71
|
|
|
|
|
4125
|
|
12
|
71
|
|
|
71
|
|
444
|
use Tie::IxHash; |
|
71
|
|
|
|
|
189
|
|
|
71
|
|
|
|
|
15258
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub new { |
15
|
61
|
|
|
61
|
0
|
206
|
my ( $class, @args ) = @_; |
16
|
|
|
|
|
|
|
|
17
|
61
|
100
|
|
|
|
3880
|
croak "BSON::Doc::new requires key/value pairs" |
18
|
|
|
|
|
|
|
if @args % 2 != 0; |
19
|
|
|
|
|
|
|
|
20
|
20
|
|
|
|
|
31
|
my $key_count =()= keys %{{@args}}; |
|
20
|
|
|
|
|
82
|
|
21
|
20
|
100
|
|
|
|
272
|
croak "Duplicate keys not allowed in BSON::Doc" |
22
|
|
|
|
|
|
|
if $key_count * 2 != @args; |
23
|
|
|
|
|
|
|
|
24
|
19
|
|
|
|
|
96
|
return bless \@args, $class; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub _as_tied_hash { |
28
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
29
|
0
|
|
|
|
|
0
|
tie my %h, 'Tie::IxHash', @$self; |
30
|
0
|
|
|
|
|
0
|
return \%h; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub _iterator { |
34
|
17
|
|
|
17
|
|
30
|
my $self = shift; |
35
|
17
|
|
|
|
|
27
|
my $index = 0; |
36
|
|
|
|
|
|
|
return sub { |
37
|
40
|
100
|
|
40
|
|
57
|
return if $index > $#{$self}; |
|
40
|
|
|
|
|
130
|
|
38
|
23
|
|
|
|
|
43
|
my ($k,$v) = @{$self}[$index, $index+1]; |
|
23
|
|
|
|
|
54
|
|
39
|
23
|
|
|
|
|
34
|
$index += 2; |
40
|
23
|
|
|
|
|
90
|
return ($k,$v); |
41
|
|
|
|
|
|
|
} |
42
|
17
|
|
|
|
|
84
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=pod |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=encoding UTF-8 |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 NAME |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
BSON::Doc - BSON type wrapper for ordered documents |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 VERSION |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
version v1.12.0 |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 SYNOPSIS |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
use BSON::Types ':all'; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
my $ordered = bson_doc( first => 1, second => 2 ); |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 DESCRIPTION |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
This module provides a BSON type wrapper representing a document preserves |
67
|
|
|
|
|
|
|
key-value order. It is currently read-only. |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=for Pod::Coverage new |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 AUTHORS |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=over 4 |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=item * |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
David Golden |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=item * |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
Stefan G. |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=back |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
This software is Copyright (c) 2019 by Stefan G. and MongoDB, Inc. |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
This is free software, licensed under: |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
The Apache License, Version 2.0, January 2004 |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=cut |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
__END__ |