Filename | /usr/local/lib/perl/5.14.2/MongoDB/OID.pm |
Statements | Executed 10 statements in 300µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 12µs | 3.33ms | BEGIN@24 | MongoDB::OID::
1 | 1 | 1 | 8µs | 36µs | BEGIN@72 | MongoDB::OID::
0 | 0 | 0 | 0s | 0s | TO_JSON | MongoDB::OID::
0 | 0 | 0 | 0s | 0s | __ANON__[:44] | MongoDB::OID::
0 | 0 | 0 | 0s | 0s | build_value | MongoDB::OID::
0 | 0 | 0 | 0s | 0s | get_time | MongoDB::OID::
0 | 0 | 0 | 0s | 0s | to_string | MongoDB::OID::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | # | ||||
2 | # Copyright 2009-2013 MongoDB, Inc. | ||||
3 | # | ||||
4 | # Licensed under the Apache License, Version 2.0 (the "License"); | ||||
5 | # you may not use this file except in compliance with the License. | ||||
6 | # You may obtain a copy of the License at | ||||
7 | # | ||||
8 | # http://www.apache.org/licenses/LICENSE-2.0 | ||||
9 | # | ||||
10 | # Unless required by applicable law or agreed to in writing, software | ||||
11 | # distributed under the License is distributed on an "AS IS" BASIS, | ||||
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
13 | # See the License for the specific language governing permissions and | ||||
14 | # limitations under the License. | ||||
15 | # | ||||
16 | |||||
17 | package MongoDB::OID; | ||||
18 | { | ||||
19 | 2 | 900ns | $MongoDB::OID::VERSION = '0.702.2'; | ||
20 | } | ||||
21 | |||||
22 | # ABSTRACT: A Mongo Object ID | ||||
23 | |||||
24 | 2 | 251µs | 2 | 6.66ms | # spent 3.33ms (12µs+3.32) within MongoDB::OID::BEGIN@24 which was called:
# once (12µs+3.32ms) by MongoDB::BEGIN@33 at line 24 # spent 3.33ms making 1 call to MongoDB::OID::BEGIN@24
# spent 3.32ms making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:519] |
25 | |||||
26 | |||||
27 | 1 | 2µs | 1 | 1.62ms | has value => ( # spent 1.62ms making 1 call to Moose::has |
28 | is => 'ro', | ||||
29 | isa => 'Str', | ||||
30 | required => 1, | ||||
31 | builder => 'build_value', | ||||
32 | ); | ||||
33 | |||||
34 | around BUILDARGS => sub { | ||||
35 | my $orig = shift; | ||||
36 | my $class = shift; | ||||
37 | if (@_ == 1) { | ||||
38 | return $class->$orig(value => $_[0]) | ||||
39 | unless ref($_[0]); | ||||
40 | return $class->$orig(value => $_[0]->value) | ||||
41 | if blessed($_[0]) && $_[0]->isa($class); | ||||
42 | } | ||||
43 | return $class->$orig(@_); | ||||
44 | 1 | 4µs | 1 | 289µs | }; # spent 289µs making 1 call to Moose::around |
45 | |||||
46 | sub build_value { | ||||
47 | my $self = shift; | ||||
48 | |||||
49 | _build_value($self, @_ ? @_ : ()); | ||||
50 | } | ||||
51 | |||||
52 | |||||
53 | sub to_string { | ||||
54 | my ($self) = @_; | ||||
55 | $self->value; | ||||
56 | } | ||||
57 | |||||
58 | |||||
59 | sub get_time { | ||||
60 | my ($self) = @_; | ||||
61 | |||||
62 | return hex(substr($self->value, 0, 8)); | ||||
63 | } | ||||
64 | |||||
65 | |||||
66 | sub TO_JSON { | ||||
67 | my ($self) = @_; | ||||
68 | return {'$oid' => $self->value}; | ||||
69 | } | ||||
70 | |||||
71 | use overload | ||||
72 | 1 | 28µs | # spent 36µs (8+28) within MongoDB::OID::BEGIN@72 which was called:
# once (8µs+28µs) by MongoDB::BEGIN@33 at line 73 # spent 28µs making 1 call to overload::import | ||
73 | 2 | 33µs | 1 | 36µs | 'fallback' => 1; # spent 36µs making 1 call to MongoDB::OID::BEGIN@72 |
74 | |||||
75 | |||||
76 | 1 | 2µs | 2 | 2.76ms | __PACKAGE__->meta->make_immutable; # spent 2.75ms making 1 call to Class::MOP::Class::make_immutable
# spent 13µs making 1 call to MongoDB::OID::meta |
77 | |||||
78 | 1 | 7µs | 1; | ||
79 | |||||
80 | __END__ |