File | /wise/base/static/lib/perl5/site_perl/5.10.0/DBIx/Class/Relationship/Accessor.pm | Statements Executed | 37 | Total Time | 0.00074 seconds |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine | |
---|---|---|---|---|---|---|
2 | 1 | 1 | 6.5e-5 | 6.5e-5 | DBIx::Class::Relationship::Accessor:: | add_relationship_accessor |
2 | 1 | 1 | 6.3e-5 | 0.00021 | DBIx::Class::Relationship::Accessor:: | register_relationship |
0 | 0 | 0 | 0 | 0 | DBIx::Class::Relationship::Accessor:: | BEGIN |
0 | 0 | 0 | 0 | 0 | DBIx::Class::Relationship::Accessor:: | __ANON__[:31] |
0 | 0 | 0 | 0 | 0 | DBIx::Class::Relationship::Accessor:: | __ANON__[:40] |
0 | 0 | 0 | 0 | 0 | DBIx::Class::Relationship::Accessor:: | __ANON__[:46] |
0 | 0 | 0 | 0 | 0 | DBIx::Class::Relationship::Accessor:: | __ANON__[:50] |
0 | 0 | 0 | 0 | 0 | DBIx::Class::Relationship::Accessor:: | __ANON__[:51] |
0 | 0 | 0 | 0 | 0 | DBIx::Class::Relationship::Accessor:: | __ANON__[:52] |
Line | Stmts. | Exclusive Time | Avg. | Code |
---|---|---|---|---|
1 | package # hide from PAUSE | |||
2 | DBIx::Class::Relationship::Accessor; | |||
3 | ||||
4 | 3 | 4.5e-5 | 1.5e-5 | use strict; # spent 10µs making 1 call to strict::import |
5 | 3 | 0.00048 | 0.00016 | use warnings; # spent 19µs making 1 call to warnings::import |
6 | ||||
7 | # spent 209µs (63+146) within DBIx::Class::Relationship::Accessor::register_relationship which was called 2 times, avg 104µs/call:
# 2 times (63µs+146µs) by DBIx::Class::ResultSourceProxy::add_relationship at line 96 of /wise/base/static/lib/perl5/site_perl/5.10.0/DBIx/Class/ResultSourceProxy.pm, avg 104µs/call | |||
8 | 2 | 5.0e-6 | 2.5e-6 | my ($class, $rel, $info) = @_; |
9 | 2 | 3.5e-5 | 1.7e-5 | if (my $acc_type = $info->{attrs}{accessor}) { # spent 65µs making 2 calls to DBIx::Class::Relationship::Accessor::add_relationship_accessor, avg 33µs/call |
10 | $class->add_relationship_accessor($rel => $acc_type); | |||
11 | } | |||
12 | 2 | 1.5e-5 | 7.5e-6 | $class->next::method($rel => $info); # spent 37µs making 2 calls to next::method, avg 18µs/call |
13 | } | |||
14 | ||||
15 | # spent 65µs within DBIx::Class::Relationship::Accessor::add_relationship_accessor which was called 2 times, avg 33µs/call:
# 2 times (65µs+0) by DBIx::Class::Relationship::Accessor::register_relationship at line 9, avg 33µs/call | |||
16 | 2 | 5.0e-6 | 2.5e-6 | my ($class, $rel, $acc_type) = @_; |
17 | 2 | 1.0e-6 | 5.0e-7 | my %meth; |
18 | 2 | 4.0e-6 | 2.0e-6 | if ($acc_type eq 'single') { |
19 | $meth{$rel} = sub { | |||
20 | my $self = shift; | |||
21 | if (@_) { | |||
22 | $self->set_from_related($rel, @_); | |||
23 | return $self->{_relationship_data}{$rel} = $_[0]; | |||
24 | } elsif (exists $self->{_relationship_data}{$rel}) { | |||
25 | return $self->{_relationship_data}{$rel}; | |||
26 | } else { | |||
27 | my $val = $self->find_related($rel, {}, {}); | |||
28 | return unless $val; | |||
29 | return $self->{_relationship_data}{$rel} = $val; | |||
30 | } | |||
31 | 1 | 6.0e-6 | 6.0e-6 | }; |
32 | } elsif ($acc_type eq 'filter') { | |||
33 | $class->throw_exception("No such column $rel to filter") | |||
34 | unless $class->has_column($rel); | |||
35 | my $f_class = $class->relationship_info($rel)->{class}; | |||
36 | $class->inflate_column($rel, | |||
37 | { inflate => sub { | |||
38 | my ($val, $self) = @_; | |||
39 | return $self->find_or_create_related($rel, {}, {}); | |||
40 | }, | |||
41 | deflate => sub { | |||
42 | my ($val, $self) = @_; | |||
43 | $self->throw_exception("$val isn't a $f_class") unless $val->isa($f_class); | |||
44 | return ($val->_ident_values)[0]; | |||
45 | # WARNING: probably breaks for multi-pri sometimes. FIXME | |||
46 | } | |||
47 | } | |||
48 | ); | |||
49 | } elsif ($acc_type eq 'multi') { | |||
50 | 1 | 5.0e-6 | 5.0e-6 | $meth{$rel} = sub { shift->search_related($rel, @_) }; |
51 | 1 | 5.0e-6 | 5.0e-6 | $meth{"${rel}_rs"} = sub { shift->search_related_rs($rel, @_) }; |
52 | 1 | 4.0e-6 | 4.0e-6 | $meth{"add_to_${rel}"} = sub { shift->create_related($rel, @_); }; |
53 | } else { | |||
54 | $class->throw_exception("No such relationship accessor type $acc_type"); | |||
55 | } | |||
56 | { | |||
57 | 5 | 3.6e-5 | 7.2e-6 | no strict 'refs'; # spent 20µs making 1 call to strict::unimport |
58 | 3 | 7.2e-5 | 2.4e-5 | no warnings 'redefine'; # spent 19µs making 1 call to warnings::unimport |
59 | 2 | 5.0e-6 | 2.5e-6 | foreach my $meth (keys %meth) { |
60 | 4 | 1.7e-5 | 4.2e-6 | *{"${class}::${meth}"} = $meth{$meth}; |
61 | } | |||
62 | } | |||
63 | } | |||
64 | ||||
65 | 1 | 3.0e-6 | 3.0e-6 | 1; |