Filename | /home/mickey/git_tree/PONAPI/Server/lib/PONAPI/Server/ConfigReader.pm |
Statements | Executed 47 statements in 1.06ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 1.82ms | 358ms | BEGIN@4 | PONAPI::Server::ConfigReader::
1 | 1 | 1 | 972µs | 33.4ms | BEGIN@8 | PONAPI::Server::ConfigReader::
1 | 1 | 1 | 830µs | 1.00s | BEGIN@10 | PONAPI::Server::ConfigReader::
1 | 1 | 1 | 26µs | 467µs | read_config | PONAPI::Server::ConfigReader::
1 | 1 | 1 | 17µs | 356µs | _build_conf | PONAPI::Server::ConfigReader::
1 | 1 | 1 | 13µs | 16µs | _set_server_send_header | PONAPI::Server::ConfigReader::
1 | 1 | 1 | 10µs | 12µs | _set_server_relative_links | PONAPI::Server::ConfigReader::
1 | 1 | 1 | 9µs | 11µs | _set_repository | PONAPI::Server::ConfigReader::
1 | 1 | 1 | 9µs | 1.15ms | BEGIN@6 | PONAPI::Server::ConfigReader::
1 | 1 | 1 | 9µs | 91µs | BEGIN@113 | PONAPI::Server::ConfigReader::
1 | 1 | 1 | 8µs | 11µs | _set_server_self_link | PONAPI::Server::ConfigReader::
1 | 1 | 1 | 8µs | 382µs | _set_server_json_api_version | PONAPI::Server::ConfigReader::
1 | 1 | 1 | 8µs | 9µs | _set_server_sorting | PONAPI::Server::ConfigReader::
1 | 1 | 1 | 7µs | 7µs | BEGIN@7 | PONAPI::Server::ConfigReader::
1 | 1 | 1 | 7µs | 41µs | __ANON__[lib/PONAPI/Server/ConfigReader.pm:15] | PONAPI::Server::ConfigReader::
0 | 0 | 0 | 0s | 0s | _set_server_respond_to_updates_status | PONAPI::Server::ConfigReader::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | # ABSTRACT: Web-Server - configuration handler | ||||
2 | package PONAPI::Server::ConfigReader; | ||||
3 | |||||
4 | 2 | 108µs | 2 | 361ms | # spent 358ms (1.82+356) within PONAPI::Server::ConfigReader::BEGIN@4 which was called:
# once (1.82ms+356ms) by PONAPI::Server::BEGIN@17 at line 4 # spent 358ms making 1 call to PONAPI::Server::ConfigReader::BEGIN@4
# spent 3.69ms making 1 call to Moose::import |
5 | |||||
6 | 2 | 28µs | 2 | 2.28ms | # spent 1.15ms (9µs+1.14) within PONAPI::Server::ConfigReader::BEGIN@6 which was called:
# once (9µs+1.14ms) by PONAPI::Server::BEGIN@17 at line 6 # spent 1.15ms making 1 call to PONAPI::Server::ConfigReader::BEGIN@6
# spent 1.14ms making 1 call to Moose::Util::TypeConstraints::import |
7 | 2 | 21µs | 1 | 7µs | # spent 7µs within PONAPI::Server::ConfigReader::BEGIN@7 which was called:
# once (7µs+0s) by PONAPI::Server::BEGIN@17 at line 7 # spent 7µs making 1 call to PONAPI::Server::ConfigReader::BEGIN@7 |
8 | 2 | 115µs | 1 | 33.4ms | # spent 33.4ms (972µs+32.4) within PONAPI::Server::ConfigReader::BEGIN@8 which was called:
# once (972µs+32.4ms) by PONAPI::Server::BEGIN@17 at line 8 # spent 33.4ms making 1 call to PONAPI::Server::ConfigReader::BEGIN@8 |
9 | |||||
10 | 2 | 526µs | 1 | 1.00s | # spent 1.00s (830µs+1000ms) within PONAPI::Server::ConfigReader::BEGIN@10 which was called:
# once (830µs+1000ms) by PONAPI::Server::BEGIN@17 at line 10 # spent 1.00s making 1 call to PONAPI::Server::ConfigReader::BEGIN@10 |
11 | |||||
12 | 1 | 2µs | 1 | 557µs | class_type 'Path::Class::Dir'; # spent 557µs making 1 call to Moose::Util::TypeConstraints::class_type |
13 | coerce 'Path::Class::Dir', | ||||
14 | from 'Str', | ||||
15 | 2 | 11µs | 4 | 415µs | # spent 41µs (7+34) within PONAPI::Server::ConfigReader::__ANON__[lib/PONAPI/Server/ConfigReader.pm:15] which was called:
# once (7µs+34µs) by Moose::Meta::TypeCoercion::__ANON__[/usr/local/lib/perl/5.18.2/Moose/Meta/TypeCoercion.pm:69] at line 65 of Moose/Meta/TypeCoercion.pm # spent 378µs making 1 call to Moose::Util::TypeConstraints::coerce
# spent 34µs making 1 call to Path::Class::Dir::new
# spent 1µs making 1 call to Moose::Util::TypeConstraints::from
# spent 1µs making 1 call to Moose::Util::TypeConstraints::via |
16 | |||||
17 | 1 | 2µs | 1 | 1.55ms | has dir => ( # spent 1.55ms making 1 call to Moose::has |
18 | is => 'ro', | ||||
19 | isa => 'Path::Class::Dir', | ||||
20 | coerce => 1, | ||||
21 | required => 1, | ||||
22 | ); | ||||
23 | |||||
24 | 1 | 1µs | 1 | 1.65ms | has config => ( # spent 1.65ms making 1 call to Moose::has |
25 | is => 'ro', | ||||
26 | isa => 'HashRef', | ||||
27 | lazy => 1, | ||||
28 | builder => '_build_conf', | ||||
29 | ); | ||||
30 | |||||
31 | # spent 356µs (17+340) within PONAPI::Server::ConfigReader::_build_conf which was called:
# once (17µs+340µs) by PONAPI::Server::ConfigReader::config at line 12 of (eval 45)[Eval/Closure.pm:144] | ||||
32 | 1 | 300ns | my $self = shift; | ||
33 | 1 | 109µs | 4 | 340µs | return YAML::XS::Load( scalar $self->dir->file('server.yml')->slurp ); # spent 169µs making 1 call to Path::Class::File::slurp
# spent 95µs making 1 call to YAML::XS::LibYAML::Load
# spent 73µs making 1 call to Path::Class::Dir::file
# spent 2µs making 1 call to PONAPI::Server::ConfigReader::dir |
34 | } | ||||
35 | |||||
36 | # spent 467µs (26+441) within PONAPI::Server::ConfigReader::read_config which was called:
# once (26µs+441µs) by PONAPI::Server::prepare_app at line 48 of lib/PONAPI/Server.pm | ||||
37 | 1 | 400ns | my $self = shift; | ||
38 | |||||
39 | 1 | 2µs | 1 | 382µs | $self->_set_server_json_api_version; # spent 382µs making 1 call to PONAPI::Server::ConfigReader::_set_server_json_api_version |
40 | |||||
41 | 1 | 2µs | 1 | 9µs | $self->_set_server_sorting; # spent 9µs making 1 call to PONAPI::Server::ConfigReader::_set_server_sorting |
42 | 1 | 2µs | 1 | 16µs | $self->_set_server_send_header; # spent 16µs making 1 call to PONAPI::Server::ConfigReader::_set_server_send_header |
43 | 1 | 2µs | 1 | 11µs | $self->_set_server_self_link; # spent 11µs making 1 call to PONAPI::Server::ConfigReader::_set_server_self_link |
44 | 1 | 1µs | 1 | 12µs | $self->_set_server_relative_links; # spent 12µs making 1 call to PONAPI::Server::ConfigReader::_set_server_relative_links |
45 | 1 | 2µs | 1 | 11µs | $self->_set_repository; # spent 11µs making 1 call to PONAPI::Server::ConfigReader::_set_repository |
46 | |||||
47 | 1 | 800ns | $self->{'ponapi.mediatype'} = 'application/vnd.api+json'; | ||
48 | |||||
49 | 1 | 6µs | return %{$self}; | ||
50 | } | ||||
51 | |||||
52 | sub _set_server_respond_to_updates_status { | ||||
53 | my $self = shift; | ||||
54 | |||||
55 | $self->{'ponapi.respond_to_updates_with_200'} = | ||||
56 | $self->config->{server}{respond_to_updates_with_200}; | ||||
57 | } | ||||
58 | |||||
59 | # spent 9µs (8+1) within PONAPI::Server::ConfigReader::_set_server_sorting which was called:
# once (8µs+1µs) by PONAPI::Server::ConfigReader::read_config at line 41 | ||||
60 | 1 | 300ns | my $self = shift; | ||
61 | |||||
62 | 1 | 1µs | 1 | 1µs | my $sort_allowed = $self->config->{server}{sort_allowed} # spent 1µs making 1 call to PONAPI::Server::ConfigReader::config |
63 | // die "[PONAPI Server] server sorting configuration is missing"; | ||||
64 | |||||
65 | $self->{'ponapi.sort_allowed'} = | ||||
66 | ( grep { $sort_allowed eq $_ } qw< yes true 1 > ) ? 1 : | ||||
67 | 1 | 5µs | ( grep { $sort_allowed eq $_ } qw< no false 0 > ) ? 0 : | ||
68 | die "[PONAPI Server] server sorting is misconfigured"; | ||||
69 | } | ||||
70 | |||||
71 | # spent 382µs (8+374) within PONAPI::Server::ConfigReader::_set_server_json_api_version which was called:
# once (8µs+374µs) by PONAPI::Server::ConfigReader::read_config at line 39 | ||||
72 | 1 | 800ns | my $self = shift; | ||
73 | |||||
74 | 1 | 4µs | 1 | 374µs | my $spec_version = $self->config->{server}{spec_version} # spent 374µs making 1 call to PONAPI::Server::ConfigReader::config |
75 | // die "[PONAPI Server] server JSON API version configuration is missing"; | ||||
76 | |||||
77 | 1 | 3µs | $self->{'ponapi.spec_version'} = $spec_version; | ||
78 | } | ||||
79 | |||||
80 | # spent 16µs (13+3) within PONAPI::Server::ConfigReader::_set_server_send_header which was called:
# once (13µs+3µs) by PONAPI::Server::ConfigReader::read_config at line 42 | ||||
81 | 1 | 400ns | my $self = shift; | ||
82 | |||||
83 | 1 | 2µs | 1 | 900ns | $self->{'ponapi.spec_version'} = $self->config->{server}{spec_version} # spent 900ns making 1 call to PONAPI::Server::ConfigReader::config |
84 | // die "[PONAPI Server] server spec version is not configured"; | ||||
85 | |||||
86 | $self->{'ponapi.send_version_header'} = | ||||
87 | 1 | 7µs | 3 | 2µs | ( grep { $self->config->{server}{send_version_header} eq $_ } qw< yes true 1 > ) ? 1 : 0; # spent 2µs making 3 calls to PONAPI::Server::ConfigReader::config, avg 800ns/call |
88 | } | ||||
89 | |||||
90 | # spent 11µs (8+3) within PONAPI::Server::ConfigReader::_set_server_self_link which was called:
# once (8µs+3µs) by PONAPI::Server::ConfigReader::read_config at line 43 | ||||
91 | 1 | 400ns | my $self = shift; | ||
92 | |||||
93 | $self->{'ponapi.doc_auto_self_link'} = | ||||
94 | 1 | 6µs | 3 | 2µs | ( grep { $self->config->{server}{send_document_self_link} eq $_ } qw< yes true 1 > ) ? 1 : 0; # spent 2µs making 3 calls to PONAPI::Server::ConfigReader::config, avg 833ns/call |
95 | } | ||||
96 | |||||
97 | # spent 12µs (10+2) within PONAPI::Server::ConfigReader::_set_server_relative_links which was called:
# once (10µs+2µs) by PONAPI::Server::ConfigReader::read_config at line 44 | ||||
98 | 1 | 200ns | my $self = shift; | ||
99 | |||||
100 | 1 | 3µs | 2 | 2µs | grep { $self->config->{server}{links_type} eq $_ } qw< relative full > # spent 2µs making 2 calls to PONAPI::Server::ConfigReader::config, avg 800ns/call |
101 | or die "[PONAPI Server] server links_type is misconfigured"; | ||||
102 | |||||
103 | 1 | 4µs | 1 | 800ns | $self->{'ponapi.relative_links'} = $self->config->{server}{links_type}; # spent 800ns making 1 call to PONAPI::Server::ConfigReader::config |
104 | } | ||||
105 | |||||
106 | # spent 11µs (9+2) within PONAPI::Server::ConfigReader::_set_repository which was called:
# once (9µs+2µs) by PONAPI::Server::ConfigReader::read_config at line 45 | ||||
107 | 1 | 300ns | my $self = shift; | ||
108 | 1 | 2µs | 1 | 900ns | $self->{'repository.class'} = $self->config->{repository}{class}; # spent 900ns making 1 call to PONAPI::Server::ConfigReader::config |
109 | 1 | 4µs | 1 | 800ns | $self->{'repository.args'} = $self->config->{repository}{args}; # spent 800ns making 1 call to PONAPI::Server::ConfigReader::config |
110 | } | ||||
111 | |||||
112 | 1 | 4µs | 2 | 2.39ms | __PACKAGE__->meta->make_immutable; # spent 2.37ms making 1 call to Class::MOP::Class::make_immutable
# spent 12µs making 1 call to PONAPI::Server::ConfigReader::meta |
113 | 3 | 66µs | 2 | 173µs | # spent 91µs (9+82) within PONAPI::Server::ConfigReader::BEGIN@113 which was called:
# once (9µs+82µs) by PONAPI::Server::BEGIN@17 at line 113 # spent 91µs making 1 call to PONAPI::Server::ConfigReader::BEGIN@113
# spent 82µs making 1 call to Moose::unimport |
114 | |||||
115 | __END__ |