| Filename | /2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/DBIx/Class/Relationship/Accessor.pm |
| Statements | Executed 20877 statements in 119ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 60 | 1 | 1 | 1.67ms | 2.59ms | DBIx::Class::Relationship::Accessor::add_relationship_accessor |
| 60 | 1 | 1 | 805µs | 4.75ms | DBIx::Class::Relationship::Accessor::register_relationship |
| 1 | 1 | 1 | 14µs | 18µs | DBIx::Class::Relationship::Accessor::BEGIN@4 |
| 1 | 1 | 1 | 8µs | 23µs | DBIx::Class::Relationship::Accessor::BEGIN@5 |
| 1 | 1 | 1 | 8µs | 22µs | DBIx::Class::Relationship::Accessor::BEGIN@72 |
| 1 | 1 | 1 | 8µs | 21µs | DBIx::Class::Relationship::Accessor::BEGIN@73 |
| 1 | 1 | 1 | 4µs | 4µs | DBIx::Class::Relationship::Accessor::BEGIN@6 |
| 0 | 0 | 0 | 0s | 0s | DBIx::Class::Relationship::Accessor::__ANON__[:46] |
| 0 | 0 | 0 | 0s | 0s | DBIx::Class::Relationship::Accessor::__ANON__[:55] |
| 0 | 0 | 0 | 0s | 0s | DBIx::Class::Relationship::Accessor::__ANON__[:61] |
| 0 | 0 | 0 | 0s | 0s | DBIx::Class::Relationship::Accessor::__ANON__[:65] |
| 0 | 0 | 0 | 0s | 0s | DBIx::Class::Relationship::Accessor::__ANON__[:66] |
| 0 | 0 | 0 | 0s | 0s | DBIx::Class::Relationship::Accessor::__ANON__[:67] |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package # hide from PAUSE | ||||
| 2 | DBIx::Class::Relationship::Accessor; | ||||
| 3 | |||||
| 4 | 3 | 24µs | 2 | 21µs | # spent 18µs (14+4) within DBIx::Class::Relationship::Accessor::BEGIN@4 which was called:
# once (14µs+4µs) by Class::C3::Componentised::ensure_class_loaded at line 4 # spent 18µs making 1 call to DBIx::Class::Relationship::Accessor::BEGIN@4
# spent 4µs making 1 call to strict::import |
| 5 | 3 | 19µs | 2 | 37µs | # spent 23µs (8+14) within DBIx::Class::Relationship::Accessor::BEGIN@5 which was called:
# once (8µs+14µs) by Class::C3::Componentised::ensure_class_loaded at line 5 # spent 23µs making 1 call to DBIx::Class::Relationship::Accessor::BEGIN@5
# spent 14µs making 1 call to warnings::import |
| 6 | 3 | 406µs | 1 | 4µs | # spent 4µs within DBIx::Class::Relationship::Accessor::BEGIN@6 which was called:
# once (4µs+0s) by Class::C3::Componentised::ensure_class_loaded at line 6 # spent 4µs making 1 call to DBIx::Class::Relationship::Accessor::BEGIN@6 |
| 7 | |||||
| 8 | 1 | 2µs | our %_pod_inherit_config = | ||
| 9 | ( | ||||
| 10 | class_map => { 'DBIx::Class::Relationship::Accessor' => 'DBIx::Class::Relationship' } | ||||
| 11 | ); | ||||
| 12 | |||||
| 13 | # spent 4.75ms (805µs+3.94) within DBIx::Class::Relationship::Accessor::register_relationship which was called 60 times, avg 79µs/call:
# 60 times (805µs+3.94ms) by DBIx::Class::ResultSourceProxy::add_relationship at line 45 of DBIx/Class/ResultSourceProxy.pm, avg 79µs/call | ||||
| 14 | 60 | 51µs | my ($class, $rel, $info) = @_; | ||
| 15 | 60 | 344µs | 60 | 2.59ms | if (my $acc_type = $info->{attrs}{accessor}) { # spent 2.59ms making 60 calls to DBIx::Class::Relationship::Accessor::add_relationship_accessor, avg 43µs/call |
| 16 | $class->add_relationship_accessor($rel => $acc_type); | ||||
| 17 | } | ||||
| 18 | 60 | 231µs | 60 | 506µs | $class->next::method($rel => $info); # spent 506µs making 60 calls to next::method, avg 8µs/call |
| 19 | } | ||||
| 20 | |||||
| 21 | # spent 2.59ms (1.67+922µs) within DBIx::Class::Relationship::Accessor::add_relationship_accessor which was called 60 times, avg 43µs/call:
# 60 times (1.67ms+922µs) by DBIx::Class::Relationship::Accessor::register_relationship at line 15, avg 43µs/call | ||||
| 22 | 60 | 49µs | my ($class, $rel, $acc_type) = @_; | ||
| 23 | 60 | 12µs | my %meth; | ||
| 24 | 60 | 57µs | if ($acc_type eq 'single') { | ||
| 25 | 36 | 307µs | 36 | 641µs | my $rel_info = $class->relationship_info($rel); # spent 641µs making 36 calls to DBIx::Class::ResultSourceProxy::relationship_info, avg 18µs/call |
| 26 | $meth{$rel} = sub { | ||||
| 27 | 3063 | 2.35ms | my $self = shift; | ||
| 28 | 3063 | 15.7ms | if (@_) { | ||
| 29 | $self->set_from_related($rel, @_); | ||||
| 30 | return $self->{_relationship_data}{$rel} = $_[0]; | ||||
| 31 | } elsif (exists $self->{_relationship_data}{$rel}) { | ||||
| 32 | return $self->{_relationship_data}{$rel}; | ||||
| 33 | } else { | ||||
| 34 | 1654 | 14.2ms | 3308 | 105ms | my $cond = $self->result_source->_resolve_condition( # spent 97.4ms making 1654 calls to DBIx::Class::ResultSource::_resolve_condition, avg 59µs/call
# spent 7.28ms making 1654 calls to DBIx::Class::Row::result_source, avg 4µs/call |
| 35 | $rel_info->{cond}, $rel, $self, $rel | ||||
| 36 | ); | ||||
| 37 | 1654 | 2.51ms | if ($rel_info->{attrs}->{undef_on_null_fk}){ | ||
| 38 | 1213 | 1.01ms | return undef unless ref($cond) eq 'HASH'; | ||
| 39 | 1213 | 2.44ms | return undef if grep { not defined $_ } values %$cond; | ||
| 40 | } | ||||
| 41 | 1654 | 38.2ms | 1654 | 5.20s | my $val = $self->find_related($rel, {}, {}); # spent 5.20s making 1654 calls to DBIx::Class::Relationship::Base::find_related, avg 3.14ms/call |
| 42 | 1654 | 4.32ms | return $val unless $val; # $val instead of undef so that null-objects can go through | ||
| 43 | |||||
| 44 | 1213 | 9.17ms | return $self->{_relationship_data}{$rel} = $val; | ||
| 45 | } | ||||
| 46 | 36 | 168µs | }; | ||
| 47 | } elsif ($acc_type eq 'filter') { | ||||
| 48 | $class->throw_exception("No such column $rel to filter") | ||||
| 49 | unless $class->has_column($rel); | ||||
| 50 | my $f_class = $class->relationship_info($rel)->{class}; | ||||
| 51 | $class->inflate_column($rel, | ||||
| 52 | { inflate => sub { | ||||
| 53 | my ($val, $self) = @_; | ||||
| 54 | return $self->find_or_new_related($rel, {}, {}); | ||||
| 55 | }, | ||||
| 56 | deflate => sub { | ||||
| 57 | my ($val, $self) = @_; | ||||
| 58 | $self->throw_exception("$val isn't a $f_class") unless $val->isa($f_class); | ||||
| 59 | return ($val->_ident_values)[0]; | ||||
| 60 | # WARNING: probably breaks for multi-pri sometimes. FIXME | ||||
| 61 | } | ||||
| 62 | } | ||||
| 63 | ); | ||||
| 64 | } elsif ($acc_type eq 'multi') { | ||||
| 65 | 3663 | 26.4ms | 3639 | 2.39s | $meth{$rel} = sub { shift->search_related($rel, @_) }; # spent 2.39s making 3639 calls to DBIx::Class::Relationship::Base::search_related, avg 658µs/call |
| 66 | 24 | 65µs | $meth{"${rel}_rs"} = sub { shift->search_related_rs($rel, @_) }; | ||
| 67 | 24 | 90µs | $meth{"add_to_${rel}"} = sub { shift->create_related($rel, @_); }; | ||
| 68 | } else { | ||||
| 69 | $class->throw_exception("No such relationship accessor type $acc_type"); | ||||
| 70 | } | ||||
| 71 | { | ||||
| 72 | 63 | 197µs | 2 | 36µs | # spent 22µs (8+14) within DBIx::Class::Relationship::Accessor::BEGIN@72 which was called:
# once (8µs+14µs) by Class::C3::Componentised::ensure_class_loaded at line 72 # spent 22µs making 1 call to DBIx::Class::Relationship::Accessor::BEGIN@72
# spent 14µs making 1 call to strict::unimport |
| 73 | 3 | 77µs | 2 | 34µs | # spent 21µs (8+13) within DBIx::Class::Relationship::Accessor::BEGIN@73 which was called:
# once (8µs+13µs) by Class::C3::Componentised::ensure_class_loaded at line 73 # spent 21µs making 1 call to DBIx::Class::Relationship::Accessor::BEGIN@73
# spent 13µs making 1 call to warnings::unimport |
| 74 | 60 | 96µs | foreach my $meth (keys %meth) { | ||
| 75 | 108 | 96µs | my $name = join '::', $class, $meth; | ||
| 76 | 108 | 793µs | 108 | 281µs | *$name = Sub::Name::subname($name, $meth{$meth}); # spent 281µs making 108 calls to Sub::Name::subname, avg 3µs/call |
| 77 | } | ||||
| 78 | } | ||||
| 79 | } | ||||
| 80 | |||||
| 81 | 1 | 3µs | 1; |