line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
71
|
|
|
71
|
|
25907
|
use 5.010001; |
|
71
|
|
|
|
|
251
|
|
2
|
71
|
|
|
71
|
|
352
|
use strict; |
|
71
|
|
|
|
|
146
|
|
|
71
|
|
|
|
|
1325
|
|
3
|
71
|
|
|
71
|
|
347
|
use warnings; |
|
71
|
|
|
|
|
136
|
|
|
71
|
|
|
|
|
2575
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package BSON::ObjectId; |
6
|
|
|
|
|
|
|
# ABSTRACT: Legacy BSON type wrapper for Object IDs (DEPRECATED) |
7
|
|
|
|
|
|
|
|
8
|
71
|
|
|
71
|
|
393
|
use version; |
|
71
|
|
|
|
|
161
|
|
|
71
|
|
|
|
|
367
|
|
9
|
|
|
|
|
|
|
our $VERSION = 'v1.12.1'; |
10
|
|
|
|
|
|
|
|
11
|
71
|
|
|
71
|
|
5353
|
use Carp; |
|
71
|
|
|
|
|
168
|
|
|
71
|
|
|
|
|
4158
|
|
12
|
|
|
|
|
|
|
|
13
|
71
|
|
|
71
|
|
464
|
use BSON::OID; |
|
71
|
|
|
|
|
135
|
|
|
71
|
|
|
|
|
21628
|
|
14
|
|
|
|
|
|
|
our @ISA = qw/BSON::OID/; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub new { |
17
|
9098
|
|
|
9098
|
1
|
184532
|
my ( $class, $value ) = @_; |
18
|
9098
|
|
|
|
|
16380
|
my $self = bless {}, $class; |
19
|
9098
|
100
|
|
|
|
16866
|
if ( $value ) { |
20
|
7
|
|
|
|
|
23
|
$self->value( $value ); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
else { |
23
|
9091
|
|
|
|
|
23054
|
$self->{oid} = BSON::OID::_packed_oid(); |
24
|
|
|
|
|
|
|
} |
25
|
9096
|
|
|
|
|
29558
|
return $self; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub value { |
29
|
9
|
|
|
9
|
0
|
23
|
my ( $self, $new_value ) = @_; |
30
|
9
|
100
|
|
|
|
23
|
if ( defined $new_value ) { |
31
|
7
|
100
|
100
|
|
|
34
|
if ( length($new_value) == 12 ) { |
|
|
100
|
|
|
|
|
|
32
|
2
|
|
|
|
|
52
|
$self->{oid} = $new_value; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
elsif ( length($new_value) == 24 && $self->is_legal($new_value) ) { |
35
|
3
|
|
|
|
|
86
|
$self->{oid} = pack("H*", $new_value); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
else { |
38
|
2
|
|
|
|
|
344
|
croak("BSON::ObjectId must be a 12 byte or 24 char hex value"); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
} |
41
|
7
|
|
|
|
|
23
|
return $self->{oid}; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub is_legal { |
45
|
5
|
|
|
5
|
0
|
35
|
$_[1] =~ /^[0-9a-f]{24}$/i; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
0
|
|
|
0
|
0
|
|
sub to_s { $_[0]->to_string } |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
1; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=pod |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=encoding UTF-8 |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 NAME |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
BSON::ObjectId - Legacy BSON type wrapper for Object IDs (DEPRECATED) |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 VERSION |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
version v1.12.1 |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 DESCRIPTION |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
This module has been deprecated as it was not compatible with |
67
|
|
|
|
|
|
|
the official MongoDB BSON implementation on CPAN. |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
You are strongly encouraged to use L instead. |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=for Pod::Coverage to_s is_legal new value |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 AUTHORS |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=over 4 |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=item * |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
David Golden |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=item * |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
Stefan G. |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=back |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
This software is Copyright (c) 2019 by Stefan G. and MongoDB, Inc. |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
This is free software, licensed under: |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
The Apache License, Version 2.0, January 2004 |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=cut |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
__END__ |