Profile of lib/PONAPI/DAO/Request/CreateRelationships.pm

← Index
NYTProf Performance Profile «line view»
For script/ponapi
Run on Wed Feb 10 15:51:26 2016
Reported on Thu Feb 11 09:43:11 2016

Filename | /home/mickey/git_tree/PONAPI/Server/lib/PONAPI/DAO/Request/CreateRelationships.pm
Statements | Executed 8 statements in 315µs

Subroutines
Calls | P | F | Exclusive Time | Inclusive Time | Subroutine
--- | --- | --- | --- | --- | ---
1 | 1 | 1 | 20µs | 3.19ms | PONAPI::DAO::Request::CreateRelationships::::BEGIN@4PONAPI::DAO::Request::CreateRelationships::BEGIN@4
1 | 1 | 1 | 10µs | 81µs | PONAPI::DAO::Request::CreateRelationships::::BEGIN@46PONAPI::DAO::Request::CreateRelationships::BEGIN@46
0 | 0 | 0 | 0s | 0s | PONAPI::DAO::Request::CreateRelationships::::_validate_rel_typePONAPI::DAO::Request::CreateRelationships::_validate_rel_type
0 | 0 | 0 | 0s | 0s | PONAPI::DAO::Request::CreateRelationships::::check_data_type_matchPONAPI::DAO::Request::CreateRelationships::check_data_type_match
0 | 0 | 0 | 0s | 0s | PONAPI::DAO::Request::CreateRelationships::::executePONAPI::DAO::Request::CreateRelationships::execute

Call graph for these subroutines as a Graphviz dot language file.

Line | State ments | Time on line | Calls | Time in subs | Code
--- | --- | --- | --- | --- | ---
1 |  |  |  |  | # ABSTRACT: DAO request - create relationships
2 |  |  |  |  | package PONAPI::DAO::Request::CreateRelationships;
3 |  |  |  |  |
4 | 2 | 246µs | 2 | 6.35ms | # spent 3.19ms (20µs+3.17) within PONAPI::DAO::Request::CreateRelationships::BEGIN@4 which was called: # once (20µs+3.17ms) by PONAPI::DAO::BEGIN@11 at line 4 use Moose; # spent 3.19ms making 1 call to PONAPI::DAO::Request::CreateRelationships::BEGIN@4 # spent 3.17ms making 1 call to Moose::import
5 |  |  |  |  |
6 | 1 | 2µs | 1 | 646µs | extends 'PONAPI::DAO::Request'; # spent 646µs making 1 call to Moose::extends
7 |  |  |  |  |
8 | 1 | 4µs | 1 | 49.6ms | with 'PONAPI::DAO::Request::Role::UpdateLike', # spent 49.6ms making 1 call to Moose::with
9 |  |  |  |  | 'PONAPI::DAO::Request::Role::HasDataBulk',
10 |  |  |  |  | 'PONAPI::DAO::Request::Role::HasDataMethods',
11 |  |  |  |  | 'PONAPI::DAO::Request::Role::HasID',
12 |  |  |  |  | 'PONAPI::DAO::Request::Role::HasRelationshipType';
13 |  |  |  |  |
14 |  |  |  |  | sub check_data_type_match { 1 } # to avoid code duplications in HasDataMethods
15 |  |  |  |  |
16 |  |  |  |  | sub execute {
17 |  |  |  |  | my $self = shift;
18 |  |  |  |  |
19 |  |  |  |  | if ( $self->is_valid ) {
20 |  |  |  |  | my @ret = $self->repository->create_relationships( %{ $self } );
21 |  |  |  |  | $self->_add_success_meta(@ret)
22 |  |  |  |  | if $self->_verify_update_response(@ret);
23 |  |  |  |  | }
24 |  |  |  |  |
25 |  |  |  |  | return $self->response();
26 |  |  |  |  | }
27 |  |  |  |  |
28 |  |  |  |  | sub _validate_rel_type {
29 |  |  |  |  | my ( $self, $args ) = @_;
30 |  |  |  |  |
31 |  |  |  |  | return $self->_bad_request( "`relationship type` is missing for this request" )
32 |  |  |  |  | unless $self->has_rel_type;
33 |  |  |  |  |
34 |  |  |  |  | my $type = $self->type;
35 |  |  |  |  | my $rel_type = $self->rel_type;
36 |  |  |  |  |
37 |  |  |  |  | return $self->_bad_request( "Types `$type` and `$rel_type` are not related", 404 )
38 |  |  |  |  | unless $self->repository->has_relationship( $type, $rel_type );
39 |  |  |  |  |
40 |  |  |  |  | return $self->_bad_request( "Types `$type` and `$rel_type` are one-to-one" )
41 |  |  |  |  | unless $self->repository->has_one_to_many_relationship( $type, $rel_type );
42 |  |  |  |  | }
43 |  |  |  |  |
44 |  |  |  |  |
45 | 1 | 4µs | 2 | 10.7ms | __PACKAGE__->meta->make_immutable; # spent 10.7ms making 1 call to Class::MOP::Class::make_immutable # spent 14µs making 1 call to PONAPI::DAO::Request::CreateRelationships::meta
46 | 3 | 60µs | 2 | 153µs | # spent 81µs (10+72) within PONAPI::DAO::Request::CreateRelationships::BEGIN@46 which was called: # once (10µs+72µs) by PONAPI::DAO::BEGIN@11 at line 46 no Moose; 1; # spent 81µs making 1 call to PONAPI::DAO::Request::CreateRelationships::BEGIN@46 # spent 72µs making 1 call to Moose::unimport
47 |  |  |  |  |
48 |  |  |  |  | __END__