Filename | /usr/share/perl5/DBIx/Class/Relationship/ProxyMethods.pm |
Statements | Executed 969 statements in 3.64ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 16µs | 59µs | BEGIN@7 | DBIx::Class::Relationship::ProxyMethods::
1 | 1 | 1 | 16µs | 24µs | BEGIN@4 | DBIx::Class::Relationship::ProxyMethods::
1 | 1 | 1 | 14µs | 97µs | BEGIN@6 | DBIx::Class::Relationship::ProxyMethods::
1 | 1 | 1 | 9µs | 100µs | BEGIN@8 | DBIx::Class::Relationship::ProxyMethods::
1 | 1 | 1 | 8µs | 13µs | BEGIN@5 | DBIx::Class::Relationship::ProxyMethods::
0 | 0 | 0 | 0s | 0s | _build_proxy_map_from | DBIx::Class::Relationship::ProxyMethods::
0 | 0 | 0 | 0s | 0s | proxy_to_related | DBIx::Class::Relationship::ProxyMethods::
0 | 0 | 0 | 0s | 0s | register_relationship | DBIx::Class::Relationship::ProxyMethods::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package # hide from PAUSE | ||||
2 | DBIx::Class::Relationship::ProxyMethods; | ||||
3 | |||||
4 | 2 | 39µs | 2 | 32µs | # spent 24µs (16+8) within DBIx::Class::Relationship::ProxyMethods::BEGIN@4 which was called:
# once (16µs+8µs) by Class::C3::Componentised::ensure_class_loaded at line 4 # spent 24µs making 1 call to DBIx::Class::Relationship::ProxyMethods::BEGIN@4
# spent 8µs making 1 call to strict::import |
5 | 2 | 32µs | 2 | 18µs | # spent 13µs (8+5) within DBIx::Class::Relationship::ProxyMethods::BEGIN@5 which was called:
# once (8µs+5µs) by Class::C3::Componentised::ensure_class_loaded at line 5 # spent 13µs making 1 call to DBIx::Class::Relationship::ProxyMethods::BEGIN@5
# spent 5µs making 1 call to warnings::import |
6 | 2 | 139µs | 2 | 97µs | # spent 97µs (14+83) within DBIx::Class::Relationship::ProxyMethods::BEGIN@6 which was called:
# once (14µs+83µs) by Class::C3::Componentised::ensure_class_loaded at line 6 # spent 97µs making 1 call to DBIx::Class::Relationship::ProxyMethods::BEGIN@6
# spent 83µs making 1 call to base::import, recursion: max depth 1, sum of overlapping time 83µs |
7 | 2 | 92µs | 2 | 101µs | # spent 59µs (16+42) within DBIx::Class::Relationship::ProxyMethods::BEGIN@7 which was called:
# once (16µs+42µs) by Class::C3::Componentised::ensure_class_loaded at line 7 # spent 59µs making 1 call to DBIx::Class::Relationship::ProxyMethods::BEGIN@7
# spent 42µs making 1 call to Exporter::import |
8 | 2 | 434µs | 2 | 190µs | # spent 100µs (9+90) within DBIx::Class::Relationship::ProxyMethods::BEGIN@8 which was called:
# once (9µs+90µs) by Class::C3::Componentised::ensure_class_loaded at line 8 # spent 100µs making 1 call to DBIx::Class::Relationship::ProxyMethods::BEGIN@8
# spent 90µs making 1 call to namespace::clean::import |
9 | |||||
10 | 1 | 2µs | our %_pod_inherit_config = | ||
11 | ( | ||||
12 | class_map => { 'DBIx::Class::Relationship::ProxyMethods' => 'DBIx::Class::Relationship' } | ||||
13 | ); | ||||
14 | |||||
15 | sub register_relationship { | ||||
16 | 319 | 178µs | my ($class, $rel, $info) = @_; | ||
17 | 319 | 272µs | if (my $proxy_args = $info->{attrs}{proxy}) { | ||
18 | $class->proxy_to_related($rel, $proxy_args); | ||||
19 | } | ||||
20 | 319 | 2.45ms | 319 | 1.41ms | $class->next::method($rel, $info); # spent 1.41ms making 319 calls to next::method, avg 4µs/call |
21 | } | ||||
22 | |||||
23 | sub proxy_to_related { | ||||
24 | my ($class, $rel, $proxy_args) = @_; | ||||
25 | my %proxy_map = $class->_build_proxy_map_from($proxy_args); | ||||
26 | |||||
27 | quote_sub "${class}::$_", sprintf( <<'EOC', $rel, $proxy_map{$_} ) | ||||
28 | my $self = shift; | ||||
29 | my $relobj = $self->%1$s; | ||||
30 | if (@_ && !defined $relobj) { | ||||
31 | $relobj = $self->create_related( %1$s => { %2$s => $_[0] } ); | ||||
32 | @_ = (); | ||||
33 | } | ||||
34 | $relobj ? $relobj->%2$s(@_) : undef; | ||||
35 | EOC | ||||
36 | for keys %proxy_map | ||||
37 | } | ||||
38 | |||||
39 | sub _build_proxy_map_from { | ||||
40 | my ( $class, $proxy_arg ) = @_; | ||||
41 | my $ref = ref $proxy_arg; | ||||
42 | |||||
43 | if ($ref eq 'HASH') { | ||||
44 | return %$proxy_arg; | ||||
45 | } | ||||
46 | elsif ($ref eq 'ARRAY') { | ||||
47 | return map { | ||||
48 | (ref $_ eq 'HASH') | ||||
49 | ? (%$_) | ||||
50 | : ($_ => $_) | ||||
51 | } @$proxy_arg; | ||||
52 | } | ||||
53 | elsif ($ref) { | ||||
54 | $class->throw_exception("Unable to process the 'proxy' argument $proxy_arg"); | ||||
55 | } | ||||
56 | else { | ||||
57 | return ( $proxy_arg => $proxy_arg ); | ||||
58 | } | ||||
59 | } | ||||
60 | |||||
61 | 1 | 3µs | 1 | 48µs | 1; # spent 48µs making 1 call to B::Hooks::EndOfScope::XS::__ANON__ |