line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
71
|
|
|
71
|
|
23087
|
use 5.010001; |
|
71
|
|
|
|
|
222
|
|
2
|
71
|
|
|
71
|
|
340
|
use strict; |
|
71
|
|
|
|
|
139
|
|
|
71
|
|
|
|
|
1220
|
|
3
|
71
|
|
|
71
|
|
328
|
use warnings; |
|
71
|
|
|
|
|
130
|
|
|
71
|
|
|
|
|
2408
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package BSON::ObjectId; |
6
|
|
|
|
|
|
|
# ABSTRACT: Legacy BSON type wrapper for Object IDs (DEPRECATED) |
7
|
|
|
|
|
|
|
|
8
|
71
|
|
|
71
|
|
386
|
use version; |
|
71
|
|
|
|
|
145
|
|
|
71
|
|
|
|
|
298
|
|
9
|
|
|
|
|
|
|
our $VERSION = 'v1.12.0'; |
10
|
|
|
|
|
|
|
|
11
|
71
|
|
|
71
|
|
5064
|
use Carp; |
|
71
|
|
|
|
|
144
|
|
|
71
|
|
|
|
|
3965
|
|
12
|
|
|
|
|
|
|
|
13
|
71
|
|
|
71
|
|
441
|
use BSON::OID; |
|
71
|
|
|
|
|
137
|
|
|
71
|
|
|
|
|
19682
|
|
14
|
|
|
|
|
|
|
our @ISA = qw/BSON::OID/; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub new { |
17
|
8686
|
|
|
8686
|
1
|
154780
|
my ( $class, $value ) = @_; |
18
|
8686
|
|
|
|
|
13394
|
my $self = bless {}, $class; |
19
|
8686
|
100
|
|
|
|
14790
|
if ( $value ) { |
20
|
7
|
|
|
|
|
17
|
$self->value( $value ); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
else { |
23
|
8679
|
|
|
|
|
18069
|
$self->{oid} = BSON::OID::_packed_oid(); |
24
|
|
|
|
|
|
|
} |
25
|
8684
|
|
|
|
|
23651
|
return $self; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub value { |
29
|
9
|
|
|
9
|
0
|
20
|
my ( $self, $new_value ) = @_; |
30
|
9
|
100
|
|
|
|
23
|
if ( defined $new_value ) { |
31
|
7
|
100
|
100
|
|
|
30
|
if ( length($new_value) == 12 ) { |
|
|
100
|
|
|
|
|
|
32
|
2
|
|
|
|
|
46
|
$self->{oid} = $new_value; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
elsif ( length($new_value) == 24 && $self->is_legal($new_value) ) { |
35
|
3
|
|
|
|
|
53
|
$self->{oid} = pack("H*", $new_value); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
else { |
38
|
2
|
|
|
|
|
260
|
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
|
29
|
$_[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.0 |
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__ |