| Filename | /usr/share/perl5/Moo/Object.pm |
| Statements | Executed 28 statements in 571µs |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 2 | 1 | 1 | 26µs | 31µs | Moo::Object::new |
| 1 | 1 | 1 | 17µs | 51µs | Moo::Object::BEGIN@3 |
| 1 | 1 | 1 | 9µs | 17µs | Moo::Object::BEGIN@69 |
| 1 | 1 | 1 | 5µs | 5µs | Moo::Object::BUILDARGS |
| 0 | 0 | 0 | 0s | 0s | Moo::Object::BUILDALL |
| 0 | 0 | 0 | 0s | 0s | Moo::Object::DEMOLISHALL |
| 0 | 0 | 0 | 0s | 0s | Moo::Object::does |
| 0 | 0 | 0 | 0s | 0s | Moo::Object::meta |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package Moo::Object; | ||||
| 2 | |||||
| 3 | 3 | 409µs | 3 | 86µs | # spent 51µs (17+34) within Moo::Object::BEGIN@3 which was called:
# once (17µs+34µs) by DBIx::Class::Storage::BlockRunner::BEGIN@16 at line 3 # spent 51µs making 1 call to Moo::Object::BEGIN@3
# spent 20µs making 1 call to strictures::import
# spent 15µs making 1 call to strictures::VERSION |
| 4 | |||||
| 5 | 1 | 300ns | our %NO_BUILD; | ||
| 6 | 1 | 100ns | our %NO_DEMOLISH; | ||
| 7 | 1 | 100ns | our $BUILD_MAKER; | ||
| 8 | 1 | 0s | our $DEMOLISH_MAKER; | ||
| 9 | |||||
| 10 | # spent 31µs (26+5) within Moo::Object::new which was called 2 times, avg 16µs/call:
# 2 times (26µs+5µs) by Moo::_accessor_maker_for at line 143 of Moo.pm, avg 16µs/call | ||||
| 11 | 3 | 1µs | my $class = shift; | ||
| 12 | 3 | 3µs | unless (exists $NO_DEMOLISH{$class}) { | ||
| 13 | 2 | 21µs | 2 | 4µs | unless ($NO_DEMOLISH{$class} = !$class->can('DEMOLISH')) { # spent 4µs making 2 calls to UNIVERSAL::can, avg 2µs/call |
| 14 | ($DEMOLISH_MAKER ||= do { | ||||
| 15 | require Method::Generate::DemolishAll; | ||||
| 16 | Method::Generate::DemolishAll->new | ||||
| 17 | })->generate_method($class); | ||||
| 18 | } | ||||
| 19 | } | ||||
| 20 | $NO_BUILD{$class} and | ||||
| 21 | 3 | 6µs | return bless({ ref($_[0]) eq 'HASH' ? %{$_[0]} : @_ }, $class); | ||
| 22 | 2 | 12µs | 2 | 4µs | $NO_BUILD{$class} = !$class->can('BUILD') unless exists $NO_BUILD{$class}; # spent 4µs making 2 calls to UNIVERSAL::can, avg 2µs/call |
| 23 | $NO_BUILD{$class} | ||||
| 24 | ? bless({ ref($_[0]) eq 'HASH' ? %{$_[0]} : @_ }, $class) | ||||
| 25 | 2 | 8µs | : do { | ||
| 26 | my $proto = ref($_[0]) eq 'HASH' ? $_[0] : { @_ }; | ||||
| 27 | bless({ %$proto }, $class)->BUILDALL($proto); | ||||
| 28 | }; | ||||
| 29 | } | ||||
| 30 | |||||
| 31 | # Inlined into Method::Generate::Constructor::_generate_args() - keep in sync | ||||
| 32 | # spent 5µs within Moo::Object::BUILDARGS which was called:
# once (5µs+0s) by Method::Generate::Constructor::new at line 206 of Method/Generate/Constructor.pm | ||||
| 33 | 1 | 400ns | my $class = shift; | ||
| 34 | 1 | 2µs | if ( scalar @_ == 1 ) { | ||
| 35 | unless ( defined $_[0] && ref $_[0] eq 'HASH' ) { | ||||
| 36 | die "Single parameters to new() must be a HASH ref" | ||||
| 37 | ." data => ". $_[0] ."\n"; | ||||
| 38 | } | ||||
| 39 | return { %{ $_[0] } }; | ||||
| 40 | } | ||||
| 41 | elsif ( @_ % 2 ) { | ||||
| 42 | die "The new() method for $class expects a hash reference or a" | ||||
| 43 | . " key/value list. You passed an odd number of arguments\n"; | ||||
| 44 | } | ||||
| 45 | else { | ||||
| 46 | 1 | 6µs | return {@_}; | ||
| 47 | } | ||||
| 48 | } | ||||
| 49 | |||||
| 50 | sub BUILDALL { | ||||
| 51 | my $self = shift; | ||||
| 52 | $self->${\(($BUILD_MAKER ||= do { | ||||
| 53 | require Method::Generate::BuildAll; | ||||
| 54 | Method::Generate::BuildAll->new | ||||
| 55 | })->generate_method(ref($self)))}(@_); | ||||
| 56 | } | ||||
| 57 | |||||
| 58 | sub DEMOLISHALL { | ||||
| 59 | my $self = shift; | ||||
| 60 | $self->${\(($DEMOLISH_MAKER ||= do { | ||||
| 61 | require Method::Generate::DemolishAll; | ||||
| 62 | Method::Generate::DemolishAll->new | ||||
| 63 | })->generate_method(ref($self)))}(@_); | ||||
| 64 | } | ||||
| 65 | |||||
| 66 | sub does { | ||||
| 67 | require Moo::Role; | ||||
| 68 | my $does = Moo::Role->can("does_role"); | ||||
| 69 | 2 | 100µs | 2 | 26µs | # spent 17µs (9+9) within Moo::Object::BEGIN@69 which was called:
# once (9µs+9µs) by DBIx::Class::Storage::BlockRunner::BEGIN@16 at line 69 # spent 17µs making 1 call to Moo::Object::BEGIN@69
# spent 9µs making 1 call to warnings::unimport |
| 70 | goto &$does; | ||||
| 71 | } | ||||
| 72 | |||||
| 73 | # duplicated in Moo::Role | ||||
| 74 | sub meta { | ||||
| 75 | require Moo::HandleMoose::FakeMetaClass; | ||||
| 76 | my $class = ref($_[0])||$_[0]; | ||||
| 77 | bless({ name => $class }, 'Moo::HandleMoose::FakeMetaClass'); | ||||
| 78 | } | ||||
| 79 | |||||
| 80 | 1 | 2µs | 1; |