Filename | /opt/perl-5.18.1/lib/site_perl/5.18.1/darwin-thread-multi-2level/Moose/Meta/TypeConstraint/Registry.pm |
Statements | Executed 308 statements in 1.28ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
25 | 6 | 2 | 373µs | 540µs | add_type_constraint | Moose::Meta::TypeConstraint::Registry::
51 | 4 | 1 | 218µs | 287µs | get_type_constraint | Moose::Meta::TypeConstraint::Registry::
30 | 1 | 1 | 138µs | 186µs | has_type_constraint | Moose::Meta::TypeConstraint::Registry::
1 | 1 | 1 | 16µs | 48µs | BEGIN@14 | Moose::Meta::TypeConstraint::Registry::
1 | 1 | 1 | 12µs | 12µs | BEGIN@3 | Moose::Meta::TypeConstraint::Registry::
1 | 1 | 1 | 10µs | 15µs | BEGIN@11 | Moose::Meta::TypeConstraint::Registry::
1 | 1 | 1 | 10µs | 79µs | BEGIN@16 | Moose::Meta::TypeConstraint::Registry::
1 | 1 | 1 | 9µs | 287µs | new | Moose::Meta::TypeConstraint::Registry::
1 | 1 | 1 | 9µs | 24µs | BEGIN@10 | Moose::Meta::TypeConstraint::Registry::
1 | 1 | 1 | 9µs | 498µs | BEGIN@12 | Moose::Meta::TypeConstraint::Registry::
1 | 1 | 1 | 2µs | 2µs | __ANON__[:27] | Moose::Meta::TypeConstraint::Registry::
0 | 0 | 0 | 0s | 0s | find_type_constraint | Moose::Meta::TypeConstraint::Registry::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | |||||
2 | package Moose::Meta::TypeConstraint::Registry; | ||||
3 | # spent 12µs within Moose::Meta::TypeConstraint::Registry::BEGIN@3 which was called:
# once (12µs+0s) by Moose::Util::TypeConstraints::BEGIN@42 at line 5 | ||||
4 | 1 | 7µs | $Moose::Meta::TypeConstraint::Registry::AUTHORITY = 'cpan:STEVAN'; | ||
5 | 1 | 46µs | 1 | 12µs | } # spent 12µs making 1 call to Moose::Meta::TypeConstraint::Registry::BEGIN@3 |
6 | { | ||||
7 | 2 | 1µs | $Moose::Meta::TypeConstraint::Registry::VERSION = '2.1005'; | ||
8 | } | ||||
9 | |||||
10 | 2 | 40µs | 2 | 39µs | # spent 24µs (9+15) within Moose::Meta::TypeConstraint::Registry::BEGIN@10 which was called:
# once (9µs+15µs) by Moose::Util::TypeConstraints::BEGIN@42 at line 10 # spent 24µs making 1 call to Moose::Meta::TypeConstraint::Registry::BEGIN@10
# spent 15µs making 1 call to strict::import |
11 | 2 | 30µs | 2 | 20µs | # spent 15µs (10+5) within Moose::Meta::TypeConstraint::Registry::BEGIN@11 which was called:
# once (10µs+5µs) by Moose::Util::TypeConstraints::BEGIN@42 at line 11 # spent 15µs making 1 call to Moose::Meta::TypeConstraint::Registry::BEGIN@11
# spent 5µs making 1 call to warnings::import |
12 | 2 | 44µs | 2 | 987µs | # spent 498µs (9+489) within Moose::Meta::TypeConstraint::Registry::BEGIN@12 which was called:
# once (9µs+489µs) by Moose::Util::TypeConstraints::BEGIN@42 at line 12 # spent 498µs making 1 call to Moose::Meta::TypeConstraint::Registry::BEGIN@12
# spent 489µs making 1 call to metaclass::import |
13 | |||||
14 | 2 | 38µs | 2 | 79µs | # spent 48µs (16+32) within Moose::Meta::TypeConstraint::Registry::BEGIN@14 which was called:
# once (16µs+32µs) by Moose::Util::TypeConstraints::BEGIN@42 at line 14 # spent 48µs making 1 call to Moose::Meta::TypeConstraint::Registry::BEGIN@14
# spent 32µs making 1 call to Exporter::import |
15 | |||||
16 | 2 | 393µs | 2 | 149µs | # spent 79µs (10+70) within Moose::Meta::TypeConstraint::Registry::BEGIN@16 which was called:
# once (10µs+70µs) by Moose::Util::TypeConstraints::BEGIN@42 at line 16 # spent 79µs making 1 call to Moose::Meta::TypeConstraint::Registry::BEGIN@16
# spent 70µs making 1 call to base::import |
17 | |||||
18 | 1 | 5µs | 3 | 870µs | __PACKAGE__->meta->add_attribute('parent_registry' => ( # spent 842µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute
# spent 22µs making 1 call to Moose::Meta::TypeConstraint::Registry::meta
# spent 7µs making 1 call to Class::MOP::_definition_context |
19 | reader => 'get_parent_registry', | ||||
20 | writer => 'set_parent_registry', | ||||
21 | predicate => 'has_parent_registry', | ||||
22 | Class::MOP::_definition_context(), | ||||
23 | )); | ||||
24 | |||||
25 | __PACKAGE__->meta->add_attribute('type_constraints' => ( | ||||
26 | reader => 'type_constraints', | ||||
27 | 1 | 4µs | # spent 2µs within Moose::Meta::TypeConstraint::Registry::__ANON__[/opt/perl-5.18.1/lib/site_perl/5.18.1/darwin-thread-multi-2level/Moose/Meta/TypeConstraint/Registry.pm:27] which was called:
# once (2µs+0s) by Class::MOP::Mixin::AttributeCore::default at line 45 of Class/MOP/Mixin/AttributeCore.pm | ||
28 | 1 | 6µs | 3 | 408µs | Class::MOP::_definition_context(), # spent 388µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute
# spent 13µs making 1 call to Moose::Meta::TypeConstraint::Registry::meta
# spent 7µs making 1 call to Class::MOP::_definition_context |
29 | )); | ||||
30 | |||||
31 | # spent 287µs (9+277) within Moose::Meta::TypeConstraint::Registry::new which was called:
# once (9µs+277µs) by Moose::Meta::Attribute::BEGIN@24 at line 61 of Moose/Util/TypeConstraints.pm | ||||
32 | 1 | 400ns | my $class = shift; | ||
33 | 1 | 5µs | 1 | 277µs | my $self = $class->_new(@_); # spent 277µs making 1 call to Class::MOP::Object::_new |
34 | 1 | 4µs | return $self; | ||
35 | } | ||||
36 | |||||
37 | # spent 186µs (138+47) within Moose::Meta::TypeConstraint::Registry::has_type_constraint which was called 30 times, avg 6µs/call:
# 30 times (138µs+47µs) by Moose::Util::TypeConstraints::find_type_constraint at line 316 of Moose/Util/TypeConstraints.pm, avg 6µs/call | ||||
38 | 30 | 10µs | my ($self, $type_name) = @_; | ||
39 | 30 | 105µs | 30 | 48µs | ($type_name and exists $self->type_constraints->{$type_name}) ? 1 : 0 # spent 48µs making 30 calls to Moose::Meta::TypeConstraint::Registry::type_constraints, avg 2µs/call |
40 | } | ||||
41 | |||||
42 | # spent 287µs (218+68) within Moose::Meta::TypeConstraint::Registry::get_type_constraint which was called 51 times, avg 6µs/call:
# 26 times (98µs+27µs) by Moose::Util::TypeConstraints::find_type_constraint at line 317 of Moose/Util/TypeConstraints.pm, avg 5µs/call
# 17 times (84µs+32µs) by Moose::Util::TypeConstraints::_create_type_constraint at line 539 of Moose/Util/TypeConstraints.pm, avg 7µs/call
# 4 times (22µs+6µs) by Moose::Util::TypeConstraints::create_class_type_constraint at line 166 of Moose/Util/TypeConstraints.pm, avg 7µs/call
# 4 times (15µs+4µs) by Moose::Meta::Attribute::BEGIN@24 at line 730 of Moose/Util/TypeConstraints.pm, avg 5µs/call | ||||
43 | 51 | 14µs | my ($self, $type_name) = @_; | ||
44 | 51 | 7µs | return unless defined $type_name; | ||
45 | 51 | 158µs | 51 | 68µs | $self->type_constraints->{$type_name} # spent 68µs making 51 calls to Moose::Meta::TypeConstraint::Registry::type_constraints, avg 1µs/call |
46 | } | ||||
47 | |||||
48 | # spent 540µs (373+167) within Moose::Meta::TypeConstraint::Registry::add_type_constraint which was called 25 times, avg 22µs/call:
# 17 times (244µs+108µs) by Moose::Util::TypeConstraints::_create_type_constraint at line 578 of Moose/Util/TypeConstraints.pm, avg 21µs/call
# 4 times (70µs+31µs) by Moose::Util::TypeConstraints::create_class_type_constraint at line 189 of Moose/Util/TypeConstraints.pm, avg 25µs/call
# once (14µs+10µs) by Moose::Util::TypeConstraints::Builtins::define_builtins at line 274 of Moose/Util/TypeConstraints/Builtins.pm
# once (17µs+7µs) by Moose::Util::TypeConstraints::Builtins::define_builtins at line 204 of Moose/Util/TypeConstraints/Builtins.pm
# once (14µs+6µs) by Moose::Util::TypeConstraints::Builtins::define_builtins at line 239 of Moose/Util/TypeConstraints/Builtins.pm
# once (14µs+6µs) by Moose::Util::TypeConstraints::Builtins::define_builtins at line 300 of Moose/Util/TypeConstraints/Builtins.pm | ||||
49 | 25 | 8µs | my ($self, $type) = @_; | ||
50 | |||||
51 | 25 | 215µs | 75 | 87µs | unless ( $type && blessed $type && $type->isa('Moose::Meta::TypeConstraint') ) { # spent 32µs making 25 calls to Scalar::Util::blessed, avg 1µs/call
# spent 29µs making 25 calls to UNIVERSAL::isa, avg 1µs/call
# spent 26µs making 25 calls to Moose::Meta::TypeConstraint::__ANON__[Moose/Meta/TypeConstraint.pm:16], avg 1µs/call |
52 | require Moose; | ||||
53 | Moose->throw_error("No type supplied / type is not a valid type constraint"); | ||||
54 | } | ||||
55 | |||||
56 | 25 | 129µs | 50 | 80µs | $self->type_constraints->{$type->name} = $type; # spent 42µs making 25 calls to Moose::Meta::TypeConstraint::Registry::type_constraints, avg 2µs/call
# spent 38µs making 25 calls to Moose::Meta::TypeConstraint::name, avg 2µs/call |
57 | } | ||||
58 | |||||
59 | sub find_type_constraint { | ||||
60 | my ($self, $type_name) = @_; | ||||
61 | return $self->get_type_constraint($type_name) | ||||
62 | if $self->has_type_constraint($type_name); | ||||
63 | return $self->get_parent_registry->find_type_constraint($type_name) | ||||
64 | if $self->has_parent_registry; | ||||
65 | return; | ||||
66 | } | ||||
67 | |||||
68 | 1 | 8µs | 1; | ||
69 | |||||
70 | # ABSTRACT: registry for type constraints | ||||
71 | |||||
72 | __END__ |