Filename | /Users/dde/perl5/perlbrew/perls/5.18.0t/lib/site_perl/5.18.0/darwin-thread-multi-2level/Moose/Util/TypeConstraints.pm |
Statements | Executed 1731 statements in 6.98ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 1.05ms | 2.64ms | BEGIN@33 | Moose::Util::TypeConstraints::
1 | 1 | 1 | 1.04ms | 1.28ms | BEGIN@614 | Moose::Util::TypeConstraints::
1 | 1 | 1 | 738µs | 5.06ms | BEGIN@39 | Moose::Util::TypeConstraints::
1 | 1 | 1 | 726µs | 1.82ms | BEGIN@38 | Moose::Util::TypeConstraints::
145 | 14 | 8 | 718µs | 1.57ms | find_type_constraint | Moose::Util::TypeConstraints::
1 | 1 | 1 | 715µs | 1.47ms | BEGIN@36 | Moose::Util::TypeConstraints::
1 | 1 | 1 | 702µs | 1.45ms | BEGIN@37 | Moose::Util::TypeConstraints::
1 | 1 | 1 | 633µs | 3.88ms | BEGIN@34 | Moose::Util::TypeConstraints::
24 | 13 | 1 | 583µs | 583µs | CORE:regcomp (opcode) | Moose::Util::TypeConstraints::
1 | 1 | 1 | 461µs | 1.76ms | BEGIN@42 | Moose::Util::TypeConstraints::
53 | 3 | 1 | 383µs | 5.04ms | find_or_parse_type_constraint (recurses: max depth 1, inclusive time 122µs) | Moose::Util::TypeConstraints::
17 | 2 | 1 | 313µs | 4.93ms | _create_type_constraint | Moose::Util::TypeConstraints::
19 | 1 | 1 | 220µs | 9.85ms | create_role_type_constraint | Moose::Util::TypeConstraints::
47 | 3 | 3 | 219µs | 4.45ms | find_or_create_isa_type_constraint (recurses: max depth 1, inclusive time 60µs) | Moose::Util::TypeConstraints::
53 | 1 | 1 | 135µs | 167µs | normalize_type_constraint_name | Moose::Util::TypeConstraints::
16 | 1 | 1 | 133µs | 4.77ms | subtype | Moose::Util::TypeConstraints::
5 | 2 | 1 | 70µs | 2.35ms | create_class_type_constraint | Moose::Util::TypeConstraints::
33 | 6 | 1 | 61µs | 61µs | CORE:match (opcode) | Moose::Util::TypeConstraints::
19 | 1 | 1 | 44µs | 9.89ms | role_type | Moose::Util::TypeConstraints::
3 | 1 | 1 | 41µs | 3.21ms | create_parameterized_type_constraint | Moose::Util::TypeConstraints::
6 | 2 | 1 | 33µs | 180µs | _detect_type_constraint_union | Moose::Util::TypeConstraints::
53 | 1 | 1 | 33µs | 33µs | CORE:subst (opcode) | Moose::Util::TypeConstraints::
1 | 1 | 1 | 32µs | 349µs | _create_type_constraint_union | Moose::Util::TypeConstraints::
3 | 1 | 1 | 26µs | 89µs | _parse_parameterized_type_constraint | Moose::Util::TypeConstraints::
4 | 1 | 1 | 25µs | 1.36ms | find_or_create_type_constraint | Moose::Util::TypeConstraints::
1 | 1 | 1 | 24µs | 91µs | _parse_type_constraint_union | Moose::Util::TypeConstraints::
16 | 1 | 1 | 23µs | 23µs | as | Moose::Util::TypeConstraints::
3 | 1 | 1 | 23µs | 3.06ms | _create_parameterized_type_constraint | Moose::Util::TypeConstraints::
4 | 1 | 1 | 22µs | 89µs | _detect_parameterized_type_constraint | Moose::Util::TypeConstraints::
16 | 1 | 1 | 19µs | 19µs | where | Moose::Util::TypeConstraints::
17 | 1 | 1 | 17µs | 17µs | inline_as | Moose::Util::TypeConstraints::
10 | 10 | 1 | 12µs | 12µs | CORE:qr (opcode) | Moose::Util::TypeConstraints::
4 | 1 | 1 | 12µs | 1.89ms | class_type | Moose::Util::TypeConstraints::
1 | 1 | 1 | 8µs | 310µs | type | Moose::Util::TypeConstraints::
1 | 1 | 1 | 8µs | 8µs | BEGIN@3 | Moose::Util::TypeConstraints::
1 | 1 | 1 | 8µs | 21µs | BEGIN@667 | Moose::Util::TypeConstraints::
1 | 1 | 1 | 7µs | 14µs | BEGIN@673 | Moose::Util::TypeConstraints::
1 | 1 | 1 | 7µs | 13µs | BEGIN@31 | Moose::Util::TypeConstraints::
1 | 1 | 1 | 6µs | 14µs | BEGIN@694 | Moose::Util::TypeConstraints::
1 | 1 | 1 | 6µs | 16µs | BEGIN@68 | Moose::Util::TypeConstraints::
1 | 1 | 1 | 6µs | 24µs | BEGIN@13 | Moose::Util::TypeConstraints::
1 | 1 | 1 | 6µs | 13µs | BEGIN@678 | Moose::Util::TypeConstraints::
1 | 1 | 1 | 6µs | 30µs | BEGIN@11 | Moose::Util::TypeConstraints::
1 | 1 | 1 | 6µs | 34µs | BEGIN@12 | Moose::Util::TypeConstraints::
3 | 1 | 1 | 6µs | 6µs | get_all_parameterizable_types | Moose::Util::TypeConstraints::
1 | 1 | 1 | 5µs | 5µs | BEGIN@40 | Moose::Util::TypeConstraints::
1 | 1 | 1 | 5µs | 6µs | list_all_type_constraints | Moose::Util::TypeConstraints::
1 | 1 | 1 | 5µs | 354µs | create_type_constraint_union | Moose::Util::TypeConstraints::
1 | 1 | 1 | 4µs | 4µs | BEGIN@35 | Moose::Util::TypeConstraints::
1 | 1 | 1 | 3µs | 3µs | BEGIN@32 | Moose::Util::TypeConstraints::
1 | 1 | 1 | 3µs | 3µs | BEGIN@41 | Moose::Util::TypeConstraints::
1 | 1 | 1 | 3µs | 3µs | BEGIN@10 | Moose::Util::TypeConstraints::
0 | 0 | 0 | 0s | 0s | __ANON__[:654] | Moose::Util::TypeConstraints::
0 | 0 | 0 | 0s | 0s | __ANON__[:656] | Moose::Util::TypeConstraints::
0 | 0 | 0 | 0s | 0s | __ANON__[:658] | Moose::Util::TypeConstraints::
0 | 0 | 0 | 0s | 0s | __ANON__[:73] | Moose::Util::TypeConstraints::
0 | 0 | 0 | 0s | 0s | _confess | Moose::Util::TypeConstraints::
0 | 0 | 0 | 0s | 0s | _install_type_coercions | Moose::Util::TypeConstraints::
0 | 0 | 0 | 0s | 0s | _throw_error | Moose::Util::TypeConstraints::
0 | 0 | 0 | 0s | 0s | add_parameterizable_type | Moose::Util::TypeConstraints::
0 | 0 | 0 | 0s | 0s | coerce | Moose::Util::TypeConstraints::
0 | 0 | 0 | 0s | 0s | create_duck_type_constraint | Moose::Util::TypeConstraints::
0 | 0 | 0 | 0s | 0s | create_enum_type_constraint | Moose::Util::TypeConstraints::
0 | 0 | 0 | 0s | 0s | create_named_type_constraint_union | Moose::Util::TypeConstraints::
0 | 0 | 0 | 0s | 0s | duck_type | Moose::Util::TypeConstraints::
0 | 0 | 0 | 0s | 0s | enum | Moose::Util::TypeConstraints::
0 | 0 | 0 | 0s | 0s | export_type_constraints_as_functions | Moose::Util::TypeConstraints::
0 | 0 | 0 | 0s | 0s | find_or_create_does_type_constraint | Moose::Util::TypeConstraints::
0 | 0 | 0 | 0s | 0s | from | Moose::Util::TypeConstraints::
0 | 0 | 0 | 0s | 0s | get_type_constraint_registry | Moose::Util::TypeConstraints::
0 | 0 | 0 | 0s | 0s | list_all_builtin_type_constraints | Moose::Util::TypeConstraints::
0 | 0 | 0 | 0s | 0s | match_on_type | Moose::Util::TypeConstraints::
0 | 0 | 0 | 0s | 0s | maybe_type | Moose::Util::TypeConstraints::
0 | 0 | 0 | 0s | 0s | message | Moose::Util::TypeConstraints::
0 | 0 | 0 | 0s | 0s | optimize_as | Moose::Util::TypeConstraints::
0 | 0 | 0 | 0s | 0s | register_type_constraint | Moose::Util::TypeConstraints::
0 | 0 | 0 | 0s | 0s | union | Moose::Util::TypeConstraints::
0 | 0 | 0 | 0s | 0s | via | Moose::Util::TypeConstraints::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | |||||
2 | package Moose::Util::TypeConstraints; | ||||
3 | # spent 8µs within Moose::Util::TypeConstraints::BEGIN@3 which was called:
# once (8µs+0s) by Moose::Meta::Attribute::BEGIN@24 at line 5 | ||||
4 | 1 | 4µs | $Moose::Util::TypeConstraints::AUTHORITY = 'cpan:STEVAN'; | ||
5 | 1 | 28µs | 1 | 8µs | } # spent 8µs making 1 call to Moose::Util::TypeConstraints::BEGIN@3 |
6 | { | ||||
7 | 2 | 700ns | $Moose::Util::TypeConstraints::VERSION = '2.1005'; | ||
8 | } | ||||
9 | |||||
10 | 2 | 21µs | 1 | 3µs | # spent 3µs within Moose::Util::TypeConstraints::BEGIN@10 which was called:
# once (3µs+0s) by Moose::Meta::Attribute::BEGIN@24 at line 10 # spent 3µs making 1 call to Moose::Util::TypeConstraints::BEGIN@10 |
11 | 2 | 22µs | 2 | 53µs | # spent 30µs (6+24) within Moose::Util::TypeConstraints::BEGIN@11 which was called:
# once (6µs+24µs) by Moose::Meta::Attribute::BEGIN@24 at line 11 # spent 30µs making 1 call to Moose::Util::TypeConstraints::BEGIN@11
# spent 24µs making 1 call to Exporter::import |
12 | 2 | 20µs | 2 | 63µs | # spent 34µs (6+28) within Moose::Util::TypeConstraints::BEGIN@12 which was called:
# once (6µs+28µs) by Moose::Meta::Attribute::BEGIN@24 at line 12 # spent 34µs making 1 call to Moose::Util::TypeConstraints::BEGIN@12
# spent 28µs making 1 call to Exporter::import |
13 | 2 | 49µs | 2 | 42µs | # spent 24µs (6+18) within Moose::Util::TypeConstraints::BEGIN@13 which was called:
# once (6µs+18µs) by Moose::Meta::Attribute::BEGIN@24 at line 13 # spent 24µs making 1 call to Moose::Util::TypeConstraints::BEGIN@13
# spent 18µs making 1 call to Moose::Exporter::import |
14 | |||||
15 | ## -------------------------------------------------------- | ||||
16 | # Prototyped subs must be predeclared because we have a | ||||
17 | # circular dependency with Moose::Meta::Attribute et. al. | ||||
18 | # so in case of us being use'd first the predeclaration | ||||
19 | # ensures the prototypes are in scope when consumers are | ||||
20 | # compiled. | ||||
21 | |||||
22 | # dah sugah! | ||||
23 | sub where (&); | ||||
24 | sub via (&); | ||||
25 | sub message (&); | ||||
26 | sub optimize_as (&); | ||||
27 | sub inline_as (&); | ||||
28 | |||||
29 | ## -------------------------------------------------------- | ||||
30 | |||||
31 | 2 | 22µs | 2 | 19µs | # spent 13µs (7+6) within Moose::Util::TypeConstraints::BEGIN@31 which was called:
# once (7µs+6µs) by Moose::Meta::Attribute::BEGIN@24 at line 31 # spent 13µs making 1 call to Moose::Util::TypeConstraints::BEGIN@31
# spent 6µs making 1 call to Package::DeprecationManager::__ANON__[Package/DeprecationManager.pm:61] |
32 | 2 | 18µs | 1 | 3µs | # spent 3µs within Moose::Util::TypeConstraints::BEGIN@32 which was called:
# once (3µs+0s) by Moose::Meta::Attribute::BEGIN@24 at line 32 # spent 3µs making 1 call to Moose::Util::TypeConstraints::BEGIN@32 |
33 | 2 | 95µs | 1 | 2.64ms | # spent 2.64ms (1.05+1.59) within Moose::Util::TypeConstraints::BEGIN@33 which was called:
# once (1.05ms+1.59ms) by Moose::Meta::Attribute::BEGIN@24 at line 33 # spent 2.64ms making 1 call to Moose::Util::TypeConstraints::BEGIN@33 |
34 | 2 | 92µs | 1 | 3.88ms | # spent 3.88ms (633µs+3.25) within Moose::Util::TypeConstraints::BEGIN@34 which was called:
# once (633µs+3.25ms) by Moose::Meta::Attribute::BEGIN@24 at line 34 # spent 3.88ms making 1 call to Moose::Util::TypeConstraints::BEGIN@34 |
35 | 2 | 20µs | 1 | 4µs | # spent 4µs within Moose::Util::TypeConstraints::BEGIN@35 which was called:
# once (4µs+0s) by Moose::Meta::Attribute::BEGIN@24 at line 35 # spent 4µs making 1 call to Moose::Util::TypeConstraints::BEGIN@35 |
36 | 2 | 92µs | 1 | 1.47ms | # spent 1.47ms (715µs+751µs) within Moose::Util::TypeConstraints::BEGIN@36 which was called:
# once (715µs+751µs) by Moose::Meta::Attribute::BEGIN@24 at line 36 # spent 1.47ms making 1 call to Moose::Util::TypeConstraints::BEGIN@36 |
37 | 2 | 91µs | 1 | 1.45ms | # spent 1.45ms (702µs+750µs) within Moose::Util::TypeConstraints::BEGIN@37 which was called:
# once (702µs+750µs) by Moose::Meta::Attribute::BEGIN@24 at line 37 # spent 1.45ms making 1 call to Moose::Util::TypeConstraints::BEGIN@37 |
38 | 2 | 96µs | 1 | 1.82ms | # spent 1.82ms (726µs+1.09) within Moose::Util::TypeConstraints::BEGIN@38 which was called:
# once (726µs+1.09ms) by Moose::Meta::Attribute::BEGIN@24 at line 38 # spent 1.82ms making 1 call to Moose::Util::TypeConstraints::BEGIN@38 |
39 | 2 | 96µs | 1 | 5.06ms | # spent 5.06ms (738µs+4.32) within Moose::Util::TypeConstraints::BEGIN@39 which was called:
# once (738µs+4.32ms) by Moose::Meta::Attribute::BEGIN@24 at line 39 # spent 5.06ms making 1 call to Moose::Util::TypeConstraints::BEGIN@39 |
40 | 2 | 21µs | 1 | 5µs | # spent 5µs within Moose::Util::TypeConstraints::BEGIN@40 which was called:
# once (5µs+0s) by Moose::Meta::Attribute::BEGIN@24 at line 40 # spent 5µs making 1 call to Moose::Util::TypeConstraints::BEGIN@40 |
41 | 2 | 18µs | 1 | 3µs | # spent 3µs within Moose::Util::TypeConstraints::BEGIN@41 which was called:
# once (3µs+0s) by Moose::Meta::Attribute::BEGIN@24 at line 41 # spent 3µs making 1 call to Moose::Util::TypeConstraints::BEGIN@41 |
42 | 2 | 172µs | 1 | 1.76ms | # spent 1.76ms (461µs+1.30) within Moose::Util::TypeConstraints::BEGIN@42 which was called:
# once (461µs+1.30ms) by Moose::Meta::Attribute::BEGIN@24 at line 42 # spent 1.76ms making 1 call to Moose::Util::TypeConstraints::BEGIN@42 |
43 | |||||
44 | 1 | 6µs | 1 | 870µs | Moose::Exporter->setup_import_methods( # spent 870µs making 1 call to Moose::Exporter::setup_import_methods |
45 | as_is => [ | ||||
46 | qw( | ||||
47 | type subtype class_type role_type maybe_type duck_type | ||||
48 | as where message optimize_as inline_as | ||||
49 | coerce from via | ||||
50 | enum union | ||||
51 | find_type_constraint | ||||
52 | register_type_constraint | ||||
53 | match_on_type ) | ||||
54 | ], | ||||
55 | ); | ||||
56 | |||||
57 | ## -------------------------------------------------------- | ||||
58 | ## type registry and some useful functions for it | ||||
59 | ## -------------------------------------------------------- | ||||
60 | |||||
61 | 1 | 1µs | 1 | 200µs | my $REGISTRY = Moose::Meta::TypeConstraint::Registry->new; # spent 200µs making 1 call to Moose::Meta::TypeConstraint::Registry::new |
62 | |||||
63 | sub get_type_constraint_registry {$REGISTRY} | ||||
64 | 1 | 5µs | 1 | 800ns | # spent 6µs (5+800ns) within Moose::Util::TypeConstraints::list_all_type_constraints which was called:
# once (5µs+800ns) by Moose::Meta::Attribute::BEGIN@24 at line 749 # spent 800ns making 1 call to Moose::Meta::TypeConstraint::Registry::type_constraints |
65 | |||||
66 | sub export_type_constraints_as_functions { | ||||
67 | my $pkg = caller(); | ||||
68 | 2 | 2.08ms | 2 | 25µs | # spent 16µs (6+9) within Moose::Util::TypeConstraints::BEGIN@68 which was called:
# once (6µs+9µs) by Moose::Meta::Attribute::BEGIN@24 at line 68 # spent 16µs making 1 call to Moose::Util::TypeConstraints::BEGIN@68
# spent 9µs making 1 call to strict::unimport |
69 | foreach my $constraint ( keys %{ $REGISTRY->type_constraints } ) { | ||||
70 | my $tc = $REGISTRY->get_type_constraint($constraint) | ||||
71 | ->_compiled_type_constraint; | ||||
72 | *{"${pkg}::${constraint}"} | ||||
73 | = sub { $tc->( $_[0] ) ? 1 : undef }; # the undef is for compat | ||||
74 | } | ||||
75 | } | ||||
76 | |||||
77 | # spent 354µs (5+349) within Moose::Util::TypeConstraints::create_type_constraint_union which was called:
# once (5µs+349µs) by Moose::Util::TypeConstraints::find_or_parse_type_constraint at line 274 | ||||
78 | 1 | 4µs | 1 | 349µs | _create_type_constraint_union(\@_); # spent 349µs making 1 call to Moose::Util::TypeConstraints::_create_type_constraint_union |
79 | } | ||||
80 | |||||
81 | sub create_named_type_constraint_union { | ||||
82 | my $name = shift; | ||||
83 | _create_type_constraint_union($name, \@_); | ||||
84 | } | ||||
85 | |||||
86 | # spent 349µs (32+317) within Moose::Util::TypeConstraints::_create_type_constraint_union which was called:
# once (32µs+317µs) by Moose::Util::TypeConstraints::create_type_constraint_union at line 78 | ||||
87 | 1 | 100ns | my $name; | ||
88 | 1 | 400ns | $name = shift if @_ > 1; | ||
89 | 1 | 900ns | my @tcs = @{ shift() }; | ||
90 | |||||
91 | 1 | 200ns | my @type_constraint_names; | ||
92 | |||||
93 | 1 | 4µs | 2 | 101µs | if ( scalar @tcs == 1 && _detect_type_constraint_union( $tcs[0] ) ) { # spent 91µs making 1 call to Moose::Util::TypeConstraints::_parse_type_constraint_union
# spent 10µs making 1 call to Moose::Util::TypeConstraints::_detect_type_constraint_union |
94 | @type_constraint_names = _parse_type_constraint_union( $tcs[0] ); | ||||
95 | } | ||||
96 | else { | ||||
97 | @type_constraint_names = @tcs; | ||||
98 | } | ||||
99 | |||||
100 | 1 | 500ns | ( scalar @type_constraint_names >= 2 ) | ||
101 | || __PACKAGE__->_throw_error( | ||||
102 | "You must pass in at least 2 type names to make a union"); | ||||
103 | |||||
104 | 2 | 4µs | 4 | 1µs | my @type_constraints = map { # spent 1µs making 2 calls to Moose::Meta::TypeConstraint::__ANON__[Moose/Meta/TypeConstraint.pm:16], avg 650ns/call
# spent 45µs making 2 calls to Moose::Util::TypeConstraints::find_or_parse_type_constraint, avg 22µs/call, recursion: max depth 1, sum of overlapping time 45µs |
105 | 1 | 2µs | find_or_parse_type_constraint($_) | ||
106 | || __PACKAGE__->_throw_error( | ||||
107 | "Could not locate type constraint ($_) for the union"); | ||||
108 | } @type_constraint_names; | ||||
109 | |||||
110 | 1 | 1µs | my %options = ( | ||
111 | type_constraints => \@type_constraints | ||||
112 | ); | ||||
113 | 1 | 200ns | $options{name} = $name if defined $name; | ||
114 | |||||
115 | 1 | 8µs | 1 | 169µs | return Moose::Meta::TypeConstraint::Union->new(%options); # spent 169µs making 1 call to Moose::Meta::TypeConstraint::Union::new |
116 | } | ||||
117 | |||||
118 | |||||
119 | # spent 3.21ms (41µs+3.17) within Moose::Util::TypeConstraints::create_parameterized_type_constraint which was called 3 times, avg 1.07ms/call:
# 3 times (41µs+3.17ms) by Moose::Util::TypeConstraints::find_or_parse_type_constraint at line 274, avg 1.07ms/call | ||||
120 | 3 | 1µs | my $type_constraint_name = shift; | ||
121 | 3 | 6µs | 3 | 89µs | my ( $base_type, $type_parameter ) # spent 89µs making 3 calls to Moose::Util::TypeConstraints::_parse_parameterized_type_constraint, avg 30µs/call |
122 | = _parse_parameterized_type_constraint($type_constraint_name); | ||||
123 | |||||
124 | 3 | 1µs | ( defined $base_type && defined $type_parameter ) | ||
125 | || __PACKAGE__->_throw_error( | ||||
126 | "Could not parse type name ($type_constraint_name) correctly"); | ||||
127 | |||||
128 | 3 | 4µs | 3 | 13µs | if ( $REGISTRY->has_type_constraint($base_type) ) { # spent 13µs making 3 calls to Moose::Meta::TypeConstraint::Registry::has_type_constraint, avg 4µs/call |
129 | 3 | 3µs | 3 | 11µs | my $base_type_tc = $REGISTRY->get_type_constraint($base_type); # spent 11µs making 3 calls to Moose::Meta::TypeConstraint::Registry::get_type_constraint, avg 4µs/call |
130 | 3 | 10µs | 3 | 3.06ms | return _create_parameterized_type_constraint( # spent 3.06ms making 3 calls to Moose::Util::TypeConstraints::_create_parameterized_type_constraint, avg 1.02ms/call |
131 | $base_type_tc, | ||||
132 | $type_parameter | ||||
133 | ); | ||||
134 | } | ||||
135 | else { | ||||
136 | __PACKAGE__->_throw_error( | ||||
137 | "Could not locate the base type ($base_type)"); | ||||
138 | } | ||||
139 | } | ||||
140 | |||||
141 | # spent 3.06ms (23µs+3.04) within Moose::Util::TypeConstraints::_create_parameterized_type_constraint which was called 3 times, avg 1.02ms/call:
# 3 times (23µs+3.04ms) by Moose::Util::TypeConstraints::create_parameterized_type_constraint at line 130, avg 1.02ms/call | ||||
142 | 3 | 900ns | my ( $base_type_tc, $type_parameter ) = @_; | ||
143 | 3 | 23µs | 6 | 3.04ms | if ( $base_type_tc->can('parameterize') ) { # spent 3.03ms making 3 calls to Moose::Meta::TypeConstraint::Parameterizable::parameterize, avg 1.01ms/call
# spent 3µs making 3 calls to UNIVERSAL::can, avg 967ns/call |
144 | return $base_type_tc->parameterize($type_parameter); | ||||
145 | } | ||||
146 | else { | ||||
147 | return Moose::Meta::TypeConstraint::Parameterized->new( | ||||
148 | name => $base_type_tc->name . '[' . $type_parameter . ']', | ||||
149 | parent => $base_type_tc, | ||||
150 | type_parameter => | ||||
151 | find_or_create_isa_type_constraint($type_parameter), | ||||
152 | ); | ||||
153 | } | ||||
154 | } | ||||
155 | |||||
156 | #should we also support optimized checks? | ||||
157 | # spent 2.35ms (70µs+2.28) within Moose::Util::TypeConstraints::create_class_type_constraint which was called 5 times, avg 470µs/call:
# 4 times (52µs+1.82ms) by Moose::Util::TypeConstraints::class_type at line 368, avg 469µs/call
# once (18µs+458µs) by Moose::Util::TypeConstraints::find_or_create_isa_type_constraint at line 260 | ||||
158 | 5 | 2µs | my ( $class, $options ) = @_; | ||
159 | |||||
160 | # too early for this check | ||||
161 | #find_type_constraint("ClassName")->check($class) | ||||
162 | # || __PACKAGE__->_throw_error("Can't create a class type constraint because '$class' is not a class name"); | ||||
163 | |||||
164 | 5 | 4µs | my $pkg_defined_in = $options->{package_defined_in} || scalar( caller(1) ); | ||
165 | |||||
166 | 5 | 6µs | 5 | 20µs | if (my $type = $REGISTRY->get_type_constraint($class)) { # spent 20µs making 5 calls to Moose::Meta::TypeConstraint::Registry::get_type_constraint, avg 4µs/call |
167 | if (!($type->isa('Moose::Meta::TypeConstraint::Class') && $type->class eq $class)) { | ||||
168 | _confess( | ||||
169 | "The type constraint '$class' has already been created in " | ||||
170 | . $type->_package_defined_in | ||||
171 | . " and cannot be created again in " | ||||
172 | . $pkg_defined_in ) | ||||
173 | } | ||||
174 | else { | ||||
175 | return $type; | ||||
176 | } | ||||
177 | } | ||||
178 | |||||
179 | my %options = ( | ||||
180 | class => $class, | ||||
181 | name => $class, | ||||
182 | package_defined_in => $pkg_defined_in, | ||||
183 | 5 | 9µs | %{ $options || {} }, | ||
184 | ); | ||||
185 | |||||
186 | 5 | 1µs | $options{name} ||= "__ANON__"; | ||
187 | |||||
188 | 5 | 13µs | 5 | 2.18ms | my $tc = Moose::Meta::TypeConstraint::Class->new(%options); # spent 2.18ms making 5 calls to Moose::Meta::TypeConstraint::Class::new, avg 436µs/call |
189 | 5 | 6µs | 5 | 82µs | $REGISTRY->add_type_constraint($tc); # spent 82µs making 5 calls to Moose::Meta::TypeConstraint::Registry::add_type_constraint, avg 16µs/call |
190 | 5 | 14µs | return $tc; | ||
191 | } | ||||
192 | |||||
193 | # spent 9.85ms (220µs+9.63) within Moose::Util::TypeConstraints::create_role_type_constraint which was called 19 times, avg 518µs/call:
# 19 times (220µs+9.63ms) by Moose::Util::TypeConstraints::role_type at line 372, avg 518µs/call | ||||
194 | 19 | 5µs | my ( $role, $options ) = @_; | ||
195 | |||||
196 | # too early for this check | ||||
197 | #find_type_constraint("ClassName")->check($class) | ||||
198 | # || __PACKAGE__->_throw_error("Can't create a class type constraint because '$class' is not a class name"); | ||||
199 | |||||
200 | 19 | 14µs | my $pkg_defined_in = $options->{package_defined_in} || scalar( caller(1) ); | ||
201 | |||||
202 | 19 | 18µs | 19 | 77µs | if (my $type = $REGISTRY->get_type_constraint($role)) { # spent 77µs making 19 calls to Moose::Meta::TypeConstraint::Registry::get_type_constraint, avg 4µs/call |
203 | if (!($type->isa('Moose::Meta::TypeConstraint::Role') && $type->role eq $role)) { | ||||
204 | _confess( | ||||
205 | "The type constraint '$role' has already been created in " | ||||
206 | . $type->_package_defined_in | ||||
207 | . " and cannot be created again in " | ||||
208 | . $pkg_defined_in ) | ||||
209 | } | ||||
210 | else { | ||||
211 | return $type; | ||||
212 | } | ||||
213 | } | ||||
214 | |||||
215 | my %options = ( | ||||
216 | role => $role, | ||||
217 | name => $role, | ||||
218 | package_defined_in => $pkg_defined_in, | ||||
219 | 19 | 30µs | %{ $options || {} }, | ||
220 | ); | ||||
221 | |||||
222 | 19 | 4µs | $options{name} ||= "__ANON__"; | ||
223 | |||||
224 | 19 | 40µs | 19 | 9.26ms | my $tc = Moose::Meta::TypeConstraint::Role->new(%options); # spent 9.26ms making 19 calls to Moose::Meta::TypeConstraint::Role::new, avg 487µs/call |
225 | 19 | 22µs | 19 | 293µs | $REGISTRY->add_type_constraint($tc); # spent 293µs making 19 calls to Moose::Meta::TypeConstraint::Registry::add_type_constraint, avg 15µs/call |
226 | 19 | 43µs | return $tc; | ||
227 | } | ||||
228 | |||||
229 | # spent 1.36ms (25µs+1.33) within Moose::Util::TypeConstraints::find_or_create_type_constraint which was called 4 times, avg 339µs/call:
# 4 times (25µs+1.33ms) by Moose::Meta::Attribute::Native::Trait::_check_helper_type at line 112 of Moose/Meta/Attribute/Native/Trait.pm, avg 339µs/call | ||||
230 | 4 | 1µs | my ( $type_constraint_name, $options_for_anon_type ) = @_; | ||
231 | |||||
232 | 4 | 14µs | 8 | 1.33ms | if ( my $constraint # spent 1.33ms making 4 calls to Moose::Util::TypeConstraints::find_or_parse_type_constraint, avg 332µs/call
# spent 3µs making 4 calls to Moose::Meta::TypeConstraint::__ANON__[Moose/Meta/TypeConstraint.pm:16], avg 675ns/call |
233 | = find_or_parse_type_constraint($type_constraint_name) ) { | ||||
234 | return $constraint; | ||||
235 | } | ||||
236 | elsif ( defined $options_for_anon_type ) { | ||||
237 | |||||
238 | # NOTE: | ||||
239 | # if there is no $options_for_anon_type | ||||
240 | # specified, then we assume they don't | ||||
241 | # want to create one, and return nothing. | ||||
242 | |||||
243 | # otherwise assume that we should create | ||||
244 | # an ANON type with the $options_for_anon_type | ||||
245 | # options which can be passed in. It should | ||||
246 | # be noted that these don't get registered | ||||
247 | # so we need to return it. | ||||
248 | # - SL | ||||
249 | return Moose::Meta::TypeConstraint->new( | ||||
250 | name => '__ANON__', | ||||
251 | %{$options_for_anon_type} | ||||
252 | ); | ||||
253 | } | ||||
254 | |||||
255 | return; | ||||
256 | } | ||||
257 | |||||
258 | # spent 4.45ms (219µs+4.23) within Moose::Util::TypeConstraints::find_or_create_isa_type_constraint which was called 47 times, avg 95µs/call:
# 28 times (131µs+3.36ms) by Moose::Meta::Attribute::_process_isa_option at line 374 of Moose/Meta/Attribute.pm, avg 125µs/call
# 16 times (71µs+383µs) by Moose::Util::TypeConstraints::_create_type_constraint at line 565, avg 28µs/call
# 3 times (17µs+495µs) by Moose::Meta::TypeConstraint::Parameterizable::_parse_type_parameter at line 68 of Moose/Meta/TypeConstraint/Parameterizable.pm, avg 171µs/call | ||||
259 | 47 | 11µs | my ($type_constraint_name, $options) = @_; | ||
260 | 47 | 132µs | 94 | 4.22ms | find_or_parse_type_constraint($type_constraint_name) # spent 3.79ms making 47 calls to Moose::Util::TypeConstraints::find_or_parse_type_constraint, avg 81µs/call, recursion: max depth 1, sum of overlapping time 77µs
# spent 476µs making 1 call to Moose::Util::TypeConstraints::create_class_type_constraint
# spent 29µs making 46 calls to Moose::Meta::TypeConstraint::__ANON__[Moose/Meta/TypeConstraint.pm:16], avg 635ns/call |
261 | || create_class_type_constraint($type_constraint_name, $options); | ||||
262 | } | ||||
263 | |||||
264 | sub find_or_create_does_type_constraint { | ||||
265 | my ($type_constraint_name, $options) = @_; | ||||
266 | find_or_parse_type_constraint($type_constraint_name) | ||||
267 | || create_role_type_constraint($type_constraint_name, $options); | ||||
268 | } | ||||
269 | |||||
270 | # spent 5.04ms (383µs+4.66) within Moose::Util::TypeConstraints::find_or_parse_type_constraint which was called 53 times, avg 95µs/call:
# 47 times (338µs+3.37ms) by Moose::Util::TypeConstraints::find_or_create_isa_type_constraint at line 260, avg 79µs/call
# 4 times (32µs+1.30ms) by Moose::Util::TypeConstraints::find_or_create_type_constraint at line 232, avg 332µs/call
# 2 times (12µs+-12µs) by Moose::Util::TypeConstraints::_create_type_constraint_union at line 104, avg 0s/call | ||||
271 | 53 | 41µs | 53 | 167µs | my $type_constraint_name = normalize_type_constraint_name(shift); # spent 167µs making 53 calls to Moose::Util::TypeConstraints::normalize_type_constraint_name, avg 3µs/call |
272 | 53 | 500ns | my $constraint; | ||
273 | |||||
274 | 53 | 204µs | 114 | 4.55ms | if ( $constraint = find_type_constraint($type_constraint_name) ) { # spent 3.21ms making 3 calls to Moose::Util::TypeConstraints::create_parameterized_type_constraint, avg 1.07ms/call
# spent 684µs making 53 calls to Moose::Util::TypeConstraints::find_type_constraint, avg 13µs/call
# spent 354µs making 1 call to Moose::Util::TypeConstraints::create_type_constraint_union
# spent 169µs making 5 calls to Moose::Util::TypeConstraints::_detect_type_constraint_union, avg 34µs/call
# spent 89µs making 4 calls to Moose::Util::TypeConstraints::_detect_parameterized_type_constraint, avg 22µs/call
# spent 40µs making 48 calls to Moose::Meta::TypeConstraint::__ANON__[Moose/Meta/TypeConstraint.pm:16], avg 827ns/call |
275 | return $constraint; | ||||
276 | } | ||||
277 | elsif ( _detect_type_constraint_union($type_constraint_name) ) { | ||||
278 | $constraint = create_type_constraint_union($type_constraint_name); | ||||
279 | } | ||||
280 | elsif ( _detect_parameterized_type_constraint($type_constraint_name) ) { | ||||
281 | $constraint | ||||
282 | = create_parameterized_type_constraint($type_constraint_name); | ||||
283 | } | ||||
284 | else { | ||||
285 | 1 | 2µs | return; | ||
286 | } | ||||
287 | |||||
288 | 4 | 5µs | 4 | 65µs | $REGISTRY->add_type_constraint($constraint); # spent 65µs making 4 calls to Moose::Meta::TypeConstraint::Registry::add_type_constraint, avg 16µs/call |
289 | 4 | 6µs | return $constraint; | ||
290 | } | ||||
291 | |||||
292 | # spent 167µs (135+33) within Moose::Util::TypeConstraints::normalize_type_constraint_name which was called 53 times, avg 3µs/call:
# 53 times (135µs+33µs) by Moose::Util::TypeConstraints::find_or_parse_type_constraint at line 271, avg 3µs/call | ||||
293 | 53 | 7µs | my $type_constraint_name = shift; | ||
294 | 53 | 104µs | 53 | 33µs | $type_constraint_name =~ s/\s//g; # spent 33µs making 53 calls to Moose::Util::TypeConstraints::CORE:subst, avg 615ns/call |
295 | 53 | 83µs | return $type_constraint_name; | ||
296 | } | ||||
297 | |||||
298 | sub _confess { | ||||
299 | my $error = shift; | ||||
300 | |||||
301 | local $Carp::CarpLevel = $Carp::CarpLevel + 1; | ||||
302 | Carp::confess($error); | ||||
303 | } | ||||
304 | |||||
305 | ## -------------------------------------------------------- | ||||
306 | ## exported functions ... | ||||
307 | ## -------------------------------------------------------- | ||||
308 | |||||
309 | # spent 1.57ms (718µs+847µs) within Moose::Util::TypeConstraints::find_type_constraint which was called 145 times, avg 11µs/call:
# 53 times (292µs+392µs) by Moose::Util::TypeConstraints::find_or_parse_type_constraint at line 274, avg 13µs/call
# 27 times (91µs+25µs) by Moose::Meta::TypeConstraint::equals at line 253 of Moose/Meta/TypeConstraint.pm, avg 4µs/call
# 19 times (104µs+143µs) by Moose::Meta::TypeConstraint::Role::new at line 37 of Moose/Meta/TypeConstraint/Role.pm, avg 13µs/call
# 19 times (90µs+100µs) by Moose::Role::init_meta at line 126 of Moose/Role.pm, avg 10µs/call
# 8 times (40µs+52µs) by Moose::Meta::TypeConstraint::is_subtype_of at line 284 of Moose/Meta/TypeConstraint.pm, avg 11µs/call
# 5 times (27µs+37µs) by Moose::Meta::TypeConstraint::Class::new at line 35 of Moose/Meta/TypeConstraint/Class.pm, avg 13µs/call
# 4 times (21µs+38µs) by Moose::Meta::TypeConstraint::is_a_type_of at line 276 of Moose/Meta/TypeConstraint.pm, avg 15µs/call
# 4 times (21µs+24µs) by Moose::init_meta at line 165 of Moose.pm, avg 11µs/call
# once (6µs+7µs) by Moose::Util::TypeConstraints::Builtins::define_builtins at line 85 of Moose/Util/TypeConstraints/Builtins.pm
# once (6µs+7µs) by Moose::Util::TypeConstraints::Builtins::define_builtins at line 239 of Moose/Util/TypeConstraints/Builtins.pm
# once (6µs+7µs) by Moose::Util::TypeConstraints::Builtins::define_builtins at line 300 of Moose/Util/TypeConstraints/Builtins.pm
# once (6µs+7µs) by Moose::Util::TypeConstraints::Builtins::define_builtins at line 204 of Moose/Util/TypeConstraints/Builtins.pm
# once (6µs+7µs) by Moose::Util::TypeConstraints::Builtins::define_builtins at line 274 of Moose/Util/TypeConstraints/Builtins.pm
# once (4µs+900ns) by Moose::Meta::TypeConstraint::Parameterized::equals at line 34 of Moose/Meta/TypeConstraint/Parameterized.pm | ||||
310 | 145 | 25µs | my $type = shift; | ||
311 | |||||
312 | 145 | 326µs | 174 | 60µs | if ( blessed $type and $type->isa("Moose::Meta::TypeConstraint") ) { # spent 46µs making 145 calls to Scalar::Util::blessed, avg 319ns/call
# spent 14µs making 29 calls to UNIVERSAL::isa, avg 479ns/call |
313 | return $type; | ||||
314 | } | ||||
315 | else { | ||||
316 | 116 | 140µs | 116 | 477µs | return unless $REGISTRY->has_type_constraint($type); # spent 477µs making 116 calls to Moose::Meta::TypeConstraint::Registry::has_type_constraint, avg 4µs/call |
317 | 88 | 187µs | 88 | 309µs | return $REGISTRY->get_type_constraint($type); # spent 309µs making 88 calls to Moose::Meta::TypeConstraint::Registry::get_type_constraint, avg 4µs/call |
318 | } | ||||
319 | } | ||||
320 | |||||
321 | sub register_type_constraint { | ||||
322 | my $constraint = shift; | ||||
323 | __PACKAGE__->_throw_error("can't register an unnamed type constraint") | ||||
324 | unless defined $constraint->name; | ||||
325 | $REGISTRY->add_type_constraint($constraint); | ||||
326 | return $constraint; | ||||
327 | } | ||||
328 | |||||
329 | # type constructors | ||||
330 | |||||
331 | # spent 310µs (8+302) within Moose::Util::TypeConstraints::type which was called:
# once (8µs+302µs) by Moose::Util::TypeConstraints::Builtins::define_builtins at line 16 of Moose/Util/TypeConstraints/Builtins.pm | ||||
332 | 1 | 300ns | my $name = shift; | ||
333 | |||||
334 | 1 | 3µs | my %p = map { %{$_} } @_; | ||
335 | |||||
336 | 1 | 5µs | 1 | 302µs | return _create_type_constraint( # spent 302µs making 1 call to Moose::Util::TypeConstraints::_create_type_constraint |
337 | $name, undef, $p{where}, $p{message}, | ||||
338 | $p{optimize_as}, $p{inline_as}, | ||||
339 | ); | ||||
340 | } | ||||
341 | |||||
342 | # spent 4.77ms (133µs+4.63) within Moose::Util::TypeConstraints::subtype which was called 16 times, avg 298µs/call:
# 16 times (133µs+4.63ms) by Moose::Util::TypeConstraints::Builtins::define_builtins at line 17 of Moose/Util/TypeConstraints/Builtins.pm, avg 298µs/call | ||||
343 | 16 | 3µs | if ( @_ == 1 && !ref $_[0] ) { | ||
344 | __PACKAGE__->_throw_error( | ||||
345 | 'A subtype cannot consist solely of a name, it must have a parent' | ||||
346 | ); | ||||
347 | } | ||||
348 | |||||
349 | # The blessed check is mostly to accommodate MooseX::Types, which | ||||
350 | # uses an object which overloads stringification as a type name. | ||||
351 | 16 | 5µs | my $name = ref $_[0] && !blessed $_[0] ? undef : shift; | ||
352 | |||||
353 | 16 | 53µs | my %p = map { %{$_} } @_; | ||
354 | |||||
355 | # subtype Str => where { ... }; | ||||
356 | 16 | 4µs | if ( !exists $p{as} ) { | ||
357 | $p{as} = $name; | ||||
358 | $name = undef; | ||||
359 | } | ||||
360 | |||||
361 | 16 | 60µs | 16 | 4.63ms | return _create_type_constraint( # spent 4.63ms making 16 calls to Moose::Util::TypeConstraints::_create_type_constraint, avg 290µs/call |
362 | $name, $p{as}, $p{where}, $p{message}, | ||||
363 | $p{optimize_as}, $p{inline_as}, | ||||
364 | ); | ||||
365 | } | ||||
366 | |||||
367 | # spent 1.89ms (12µs+1.88) within Moose::Util::TypeConstraints::class_type which was called 4 times, avg 472µs/call:
# 4 times (12µs+1.88ms) by Moose::init_meta at line 165 of Moose.pm, avg 472µs/call | ||||
368 | 4 | 9µs | 4 | 1.88ms | create_class_type_constraint(@_); # spent 1.88ms making 4 calls to Moose::Util::TypeConstraints::create_class_type_constraint, avg 469µs/call |
369 | } | ||||
370 | |||||
371 | # spent 9.89ms (44µs+9.85) within Moose::Util::TypeConstraints::role_type which was called 19 times, avg 521µs/call:
# 19 times (44µs+9.85ms) by Moose::Role::init_meta at line 126 of Moose/Role.pm, avg 521µs/call | ||||
372 | 19 | 37µs | 19 | 9.85ms | create_role_type_constraint(@_); # spent 9.85ms making 19 calls to Moose::Util::TypeConstraints::create_role_type_constraint, avg 518µs/call |
373 | } | ||||
374 | |||||
375 | sub maybe_type { | ||||
376 | my ($type_parameter) = @_; | ||||
377 | |||||
378 | register_type_constraint( | ||||
379 | $REGISTRY->get_type_constraint('Maybe')->parameterize($type_parameter) | ||||
380 | ); | ||||
381 | } | ||||
382 | |||||
383 | sub duck_type { | ||||
384 | my ( $type_name, @methods ) = @_; | ||||
385 | if ( ref $type_name eq 'ARRAY' && !@methods ) { | ||||
386 | @methods = @$type_name; | ||||
387 | $type_name = undef; | ||||
388 | } | ||||
389 | if ( @methods == 1 && ref $methods[0] eq 'ARRAY' ) { | ||||
390 | @methods = @{ $methods[0] }; | ||||
391 | } | ||||
392 | |||||
393 | register_type_constraint( | ||||
394 | create_duck_type_constraint( | ||||
395 | $type_name, | ||||
396 | \@methods, | ||||
397 | ) | ||||
398 | ); | ||||
399 | } | ||||
400 | |||||
401 | sub coerce { | ||||
402 | my ( $type_name, @coercion_map ) = @_; | ||||
403 | _install_type_coercions( $type_name, \@coercion_map ); | ||||
404 | } | ||||
405 | |||||
406 | # The trick of returning @_ lets us avoid having to specify a | ||||
407 | # prototype. Perl will parse this: | ||||
408 | # | ||||
409 | # subtype 'Foo' | ||||
410 | # => as 'Str' | ||||
411 | # => where { ... } | ||||
412 | # | ||||
413 | # as this: | ||||
414 | # | ||||
415 | # subtype( 'Foo', as( 'Str', where { ... } ) ); | ||||
416 | # | ||||
417 | # If as() returns all its extra arguments, this just works, and | ||||
418 | # preserves backwards compatibility. | ||||
419 | 16 | 33µs | # spent 23µs within Moose::Util::TypeConstraints::as which was called 16 times, avg 1µs/call:
# 16 times (23µs+0s) by Moose::Util::TypeConstraints::Builtins::define_builtins at line 18 of Moose/Util/TypeConstraints/Builtins.pm, avg 1µs/call | ||
420 | 16 | 31µs | # spent 19µs within Moose::Util::TypeConstraints::where which was called 16 times, avg 1µs/call:
# 16 times (19µs+0s) by Moose::Util::TypeConstraints::Builtins::define_builtins at line 19 of Moose/Util/TypeConstraints/Builtins.pm, avg 1µs/call | ||
421 | sub message (&) { { message => $_[0] } } | ||||
422 | sub optimize_as (&) { { optimize_as => $_[0] } } | ||||
423 | 17 | 30µs | # spent 17µs within Moose::Util::TypeConstraints::inline_as which was called 17 times, avg 1µs/call:
# 17 times (17µs+0s) by Moose::Util::TypeConstraints::Builtins::define_builtins at line 21 of Moose/Util/TypeConstraints/Builtins.pm, avg 1µs/call | ||
424 | |||||
425 | sub from {@_} | ||||
426 | sub via (&) { $_[0] } | ||||
427 | |||||
428 | sub enum { | ||||
429 | my ( $type_name, @values ) = @_; | ||||
430 | |||||
431 | # NOTE: | ||||
432 | # if only an array-ref is passed then | ||||
433 | # you get an anon-enum | ||||
434 | # - SL | ||||
435 | if ( ref $type_name eq 'ARRAY' ) { | ||||
436 | @values == 0 | ||||
437 | || __PACKAGE__->_throw_error("enum called with an array reference and additional arguments. Did you mean to parenthesize the enum call's parameters?"); | ||||
438 | |||||
439 | @values = @$type_name; | ||||
440 | $type_name = undef; | ||||
441 | } | ||||
442 | if ( @values == 1 && ref $values[0] eq 'ARRAY' ) { | ||||
443 | @values = @{ $values[0] }; | ||||
444 | } | ||||
445 | |||||
446 | register_type_constraint( | ||||
447 | create_enum_type_constraint( | ||||
448 | $type_name, | ||||
449 | \@values, | ||||
450 | ) | ||||
451 | ); | ||||
452 | } | ||||
453 | |||||
454 | sub union { | ||||
455 | my ( $type_name, @constraints ) = @_; | ||||
456 | if ( ref $type_name eq 'ARRAY' ) { | ||||
457 | @constraints == 0 | ||||
458 | || __PACKAGE__->_throw_error("union called with an array reference and additional arguments."); | ||||
459 | @constraints = @$type_name; | ||||
460 | $type_name = undef; | ||||
461 | } | ||||
462 | if ( @constraints == 1 && ref $constraints[0] eq 'ARRAY' ) { | ||||
463 | @constraints = @{ $constraints[0] }; | ||||
464 | } | ||||
465 | if ( defined $type_name ) { | ||||
466 | return register_type_constraint( | ||||
467 | create_named_type_constraint_union( $type_name, @constraints ) | ||||
468 | ); | ||||
469 | } | ||||
470 | return create_type_constraint_union( @constraints ); | ||||
471 | } | ||||
472 | |||||
473 | sub create_enum_type_constraint { | ||||
474 | my ( $type_name, $values ) = @_; | ||||
475 | |||||
476 | Moose::Meta::TypeConstraint::Enum->new( | ||||
477 | name => $type_name || '__ANON__', | ||||
478 | values => $values, | ||||
479 | ); | ||||
480 | } | ||||
481 | |||||
482 | sub create_duck_type_constraint { | ||||
483 | my ( $type_name, $methods ) = @_; | ||||
484 | |||||
485 | Moose::Meta::TypeConstraint::DuckType->new( | ||||
486 | name => $type_name || '__ANON__', | ||||
487 | methods => $methods, | ||||
488 | ); | ||||
489 | } | ||||
490 | |||||
491 | sub match_on_type { | ||||
492 | my ($to_match, @cases) = @_; | ||||
493 | my $default; | ||||
494 | if (@cases % 2 != 0) { | ||||
495 | $default = pop @cases; | ||||
496 | (ref $default eq 'CODE') | ||||
497 | || __PACKAGE__->_throw_error("Default case must be a CODE ref, not $default"); | ||||
498 | } | ||||
499 | while (@cases) { | ||||
500 | my ($type, $action) = splice @cases, 0, 2; | ||||
501 | |||||
502 | unless (blessed $type && $type->isa('Moose::Meta::TypeConstraint')) { | ||||
503 | $type = find_or_parse_type_constraint($type) | ||||
504 | || __PACKAGE__->_throw_error("Cannot find or parse the type '$type'") | ||||
505 | } | ||||
506 | |||||
507 | (ref $action eq 'CODE') | ||||
508 | || __PACKAGE__->_throw_error("Match action must be a CODE ref, not $action"); | ||||
509 | |||||
510 | if ($type->check($to_match)) { | ||||
511 | local $_ = $to_match; | ||||
512 | return $action->($to_match); | ||||
513 | } | ||||
514 | } | ||||
515 | (defined $default) | ||||
516 | || __PACKAGE__->_throw_error("No cases matched for $to_match"); | ||||
517 | { | ||||
518 | local $_ = $to_match; | ||||
519 | return $default->($to_match); | ||||
520 | } | ||||
521 | } | ||||
522 | |||||
523 | |||||
524 | ## -------------------------------------------------------- | ||||
525 | ## desugaring functions ... | ||||
526 | ## -------------------------------------------------------- | ||||
527 | |||||
528 | # spent 4.93ms (313µs+4.62) within Moose::Util::TypeConstraints::_create_type_constraint which was called 17 times, avg 290µs/call:
# 16 times (289µs+4.34ms) by Moose::Util::TypeConstraints::subtype at line 361, avg 290µs/call
# once (24µs+278µs) by Moose::Util::TypeConstraints::type at line 336 | ||||
529 | 17 | 2µs | my $name = shift; | ||
530 | 17 | 2µs | my $parent = shift; | ||
531 | 17 | 2µs | my $check = shift; | ||
532 | 17 | 7µs | my $message = shift; | ||
533 | 17 | 3µs | my $optimized = shift; | ||
534 | 17 | 2µs | my $inlined = shift; | ||
535 | |||||
536 | 17 | 7µs | my $pkg_defined_in = scalar( caller(1) ); | ||
537 | |||||
538 | 17 | 2µs | if ( defined $name ) { | ||
539 | 17 | 15µs | 17 | 75µs | my $type = $REGISTRY->get_type_constraint($name); # spent 75µs making 17 calls to Moose::Meta::TypeConstraint::Registry::get_type_constraint, avg 4µs/call |
540 | |||||
541 | 17 | 2µs | ( $type->_package_defined_in eq $pkg_defined_in ) | ||
542 | || _confess( | ||||
543 | "The type constraint '$name' has already been created in " | ||||
544 | . $type->_package_defined_in | ||||
545 | . " and cannot be created again in " | ||||
546 | . $pkg_defined_in ) | ||||
547 | if defined $type; | ||||
548 | |||||
549 | 17 | 55µs | 17 | 26µs | $name =~ /^[\w:\.]+$/ # spent 26µs making 17 calls to Moose::Util::TypeConstraints::CORE:match, avg 2µs/call |
550 | or die qq{$name contains invalid characters for a type name.} | ||||
551 | . qq{ Names can contain alphanumeric character, ":", and "."\n}; | ||||
552 | } | ||||
553 | |||||
554 | 17 | 27µs | my %opts = ( | ||
555 | name => $name, | ||||
556 | package_defined_in => $pkg_defined_in, | ||||
557 | |||||
558 | ( $check ? ( constraint => $check ) : () ), | ||||
559 | ( $message ? ( message => $message ) : () ), | ||||
560 | ( $optimized ? ( optimized => $optimized ) : () ), | ||||
561 | ( $inlined ? ( inlined => $inlined ) : () ), | ||||
562 | ); | ||||
563 | |||||
564 | 17 | 100ns | my $constraint; | ||
565 | 17 | 91µs | 64 | 4.02ms | if ( # spent 3.55ms making 16 calls to Moose::Meta::TypeConstraint::create_child_type, avg 222µs/call
# spent 454µs making 16 calls to Moose::Util::TypeConstraints::find_or_create_isa_type_constraint, avg 28µs/call
# spent 11µs making 16 calls to Scalar::Util::blessed, avg 675ns/call
# spent 10µs making 16 calls to Moose::Meta::TypeConstraint::__ANON__[Moose/Meta/TypeConstraint.pm:16], avg 600ns/call |
566 | defined $parent | ||||
567 | and $parent | ||||
568 | = blessed $parent | ||||
569 | ? $parent | ||||
570 | : find_or_create_isa_type_constraint($parent) | ||||
571 | ) { | ||||
572 | $constraint = $parent->create_child_type(%opts); | ||||
573 | } | ||||
574 | else { | ||||
575 | 1 | 3µs | 1 | 242µs | $constraint = Moose::Meta::TypeConstraint->new(%opts); # spent 242µs making 1 call to Moose::Meta::TypeConstraint::new |
576 | } | ||||
577 | |||||
578 | 17 | 18µs | 17 | 257µs | $REGISTRY->add_type_constraint($constraint) # spent 257µs making 17 calls to Moose::Meta::TypeConstraint::Registry::add_type_constraint, avg 15µs/call |
579 | if defined $name; | ||||
580 | |||||
581 | 17 | 34µs | return $constraint; | ||
582 | } | ||||
583 | |||||
584 | sub _install_type_coercions ($$) { | ||||
585 | my ( $type_name, $coercion_map ) = @_; | ||||
586 | my $type = find_type_constraint($type_name); | ||||
587 | ( defined $type ) | ||||
588 | || __PACKAGE__->_throw_error( | ||||
589 | "Cannot find type '$type_name', perhaps you forgot to load it"); | ||||
590 | if ( $type->has_coercion ) { | ||||
591 | $type->coercion->add_type_coercions(@$coercion_map); | ||||
592 | } | ||||
593 | else { | ||||
594 | my $type_coercion = Moose::Meta::TypeCoercion->new( | ||||
595 | type_coercion_map => $coercion_map, | ||||
596 | type_constraint => $type | ||||
597 | ); | ||||
598 | $type->coercion($type_coercion); | ||||
599 | } | ||||
600 | } | ||||
601 | |||||
602 | ## -------------------------------------------------------- | ||||
603 | ## type notation parsing ... | ||||
604 | ## -------------------------------------------------------- | ||||
605 | |||||
606 | { | ||||
607 | |||||
608 | # All I have to say is mugwump++ cause I know | ||||
609 | # do not even have enough regexp-fu to be able | ||||
610 | # to have written this (I can only barely | ||||
611 | # understand it as it is) | ||||
612 | # - SL | ||||
613 | |||||
614 | 3 | 338µs | 2 | 1.29ms | # spent 1.28ms (1.04+244µs) within Moose::Util::TypeConstraints::BEGIN@614 which was called:
# once (1.04ms+244µs) by Moose::Meta::Attribute::BEGIN@24 at line 614 # spent 1.28ms making 1 call to Moose::Util::TypeConstraints::BEGIN@614
# spent 11µs making 1 call to re::import |
615 | |||||
616 | 1 | 5µs | 1 | 1µs | my $valid_chars = qr{[\w:\.]}; # spent 1µs making 1 call to Moose::Util::TypeConstraints::CORE:qr |
617 | 1 | 19µs | 2 | 14µs | my $type_atom = qr{ (?>$valid_chars+) }x; # spent 13µs making 1 call to Moose::Util::TypeConstraints::CORE:regcomp
# spent 900ns making 1 call to Moose::Util::TypeConstraints::CORE:qr |
618 | 1 | 2µs | 1 | 700ns | my $ws = qr{ (?>\s*) }x; # spent 700ns making 1 call to Moose::Util::TypeConstraints::CORE:qr |
619 | 1 | 15µs | 2 | 11µs | my $op_union = qr{ $ws \| $ws }x; # spent 7µs making 1 call to Moose::Util::TypeConstraints::CORE:regcomp
# spent 3µs making 1 call to Moose::Util::TypeConstraints::CORE:qr |
620 | |||||
621 | 1 | 100ns | my ($type, $type_capture_parts, $type_with_parameter, $union, $any); | ||
622 | 1 | 2µs | if (Class::MOP::IS_RUNNING_ON_5_10) { | ||
623 | 1 | 300ns | my $type_pattern | ||
624 | = q{ (?&type_atom) (?: \[ (?&ws) (?&any) (?&ws) \] )? }; | ||||
625 | 1 | 100ns | my $type_capture_parts_pattern | ||
626 | = q{ ((?&type_atom)) (?: \[ (?&ws) ((?&any)) (?&ws) \] )? }; | ||||
627 | 1 | 100ns | my $type_with_parameter_pattern | ||
628 | = q{ (?&type_atom) \[ (?&ws) (?&any) (?&ws) \] }; | ||||
629 | 1 | 100ns | my $union_pattern | ||
630 | = q{ (?&type) (?> (?: (?&op_union) (?&type) )+ ) }; | ||||
631 | 1 | 100ns | my $any_pattern | ||
632 | = q{ (?&type) | (?&union) }; | ||||
633 | |||||
634 | 1 | 59µs | 2 | 52µs | my $defines = qr{(?(DEFINE) # spent 51µs making 1 call to Moose::Util::TypeConstraints::CORE:regcomp
# spent 900ns making 1 call to Moose::Util::TypeConstraints::CORE:qr |
635 | (?<valid_chars> $valid_chars) | ||||
636 | (?<type_atom> $type_atom) | ||||
637 | (?<ws> $ws) | ||||
638 | (?<op_union> $op_union) | ||||
639 | (?<type> $type_pattern) | ||||
640 | (?<type_capture_parts> $type_capture_parts_pattern) | ||||
641 | (?<type_with_parameter> $type_with_parameter_pattern) | ||||
642 | (?<union> $union_pattern) | ||||
643 | (?<any> $any_pattern) | ||||
644 | )}x; | ||||
645 | |||||
646 | 1 | 52µs | 2 | 45µs | $type = qr{ $type_pattern $defines }x; # spent 44µs making 1 call to Moose::Util::TypeConstraints::CORE:regcomp
# spent 900ns making 1 call to Moose::Util::TypeConstraints::CORE:qr |
647 | 1 | 50µs | 2 | 42µs | $type_capture_parts = qr{ $type_capture_parts_pattern $defines }x; # spent 42µs making 1 call to Moose::Util::TypeConstraints::CORE:regcomp
# spent 900ns making 1 call to Moose::Util::TypeConstraints::CORE:qr |
648 | 1 | 47µs | 2 | 40µs | $type_with_parameter = qr{ $type_with_parameter_pattern $defines }x; # spent 39µs making 1 call to Moose::Util::TypeConstraints::CORE:regcomp
# spent 900ns making 1 call to Moose::Util::TypeConstraints::CORE:qr |
649 | 1 | 49µs | 2 | 42µs | $union = qr{ $union_pattern $defines }x; # spent 41µs making 1 call to Moose::Util::TypeConstraints::CORE:regcomp
# spent 900ns making 1 call to Moose::Util::TypeConstraints::CORE:qr |
650 | 1 | 47µs | 2 | 38µs | $any = qr{ $any_pattern $defines }x; # spent 37µs making 1 call to Moose::Util::TypeConstraints::CORE:regcomp
# spent 900ns making 1 call to Moose::Util::TypeConstraints::CORE:qr |
651 | } | ||||
652 | else { | ||||
653 | $type | ||||
654 | = qr{ $type_atom (?: \[ $ws (??{$any}) $ws \] )? }x; | ||||
655 | $type_capture_parts | ||||
656 | = qr{ ($type_atom) (?: \[ $ws ((??{$any})) $ws \] )? }x; | ||||
657 | $type_with_parameter | ||||
658 | = qr{ $type_atom \[ $ws (??{$any}) $ws \] }x; | ||||
659 | $union | ||||
660 | = qr{ $type (?> (?: $op_union $type )+ ) }x; | ||||
661 | $any | ||||
662 | = qr{ $type | $union }x; | ||||
663 | } | ||||
664 | |||||
665 | |||||
666 | # spent 89µs (26+63) within Moose::Util::TypeConstraints::_parse_parameterized_type_constraint which was called 3 times, avg 30µs/call:
# 3 times (26µs+63µs) by Moose::Util::TypeConstraints::create_parameterized_type_constraint at line 121, avg 30µs/call | ||||
667 | 8 | 59µs | 2 | 34µs | # spent 21µs (8+13) within Moose::Util::TypeConstraints::BEGIN@667 which was called:
# once (8µs+13µs) by Moose::Meta::Attribute::BEGIN@24 at line 667 # spent 21µs making 1 call to Moose::Util::TypeConstraints::BEGIN@667
# spent 13µs making 1 call to warnings::unimport |
668 | 3 | 76µs | 6 | 63µs | $_[0] =~ m{ $type_capture_parts }x; # spent 53µs making 3 calls to Moose::Util::TypeConstraints::CORE:regcomp, avg 18µs/call
# spent 10µs making 3 calls to Moose::Util::TypeConstraints::CORE:match, avg 3µs/call |
669 | 3 | 15µs | return ( $1, $2 ); | ||
670 | } | ||||
671 | |||||
672 | # spent 89µs (22+67) within Moose::Util::TypeConstraints::_detect_parameterized_type_constraint which was called 4 times, avg 22µs/call:
# 4 times (22µs+67µs) by Moose::Util::TypeConstraints::find_or_parse_type_constraint at line 274, avg 22µs/call | ||||
673 | 10 | 48µs | 2 | 22µs | # spent 14µs (7+7) within Moose::Util::TypeConstraints::BEGIN@673 which was called:
# once (7µs+7µs) by Moose::Meta::Attribute::BEGIN@24 at line 673 # spent 14µs making 1 call to Moose::Util::TypeConstraints::BEGIN@673
# spent 7µs making 1 call to warnings::unimport |
674 | 4 | 89µs | 8 | 67µs | $_[0] =~ m{ ^ $type_with_parameter $ }x; # spent 54µs making 4 calls to Moose::Util::TypeConstraints::CORE:regcomp, avg 14µs/call
# spent 12µs making 4 calls to Moose::Util::TypeConstraints::CORE:match, avg 3µs/call |
675 | } | ||||
676 | |||||
677 | # spent 91µs (24+67) within Moose::Util::TypeConstraints::_parse_type_constraint_union which was called:
# once (24µs+67µs) by Moose::Util::TypeConstraints::_create_type_constraint_union at line 93 | ||||
678 | 4 | 96µs | 2 | 20µs | # spent 13µs (6+7) within Moose::Util::TypeConstraints::BEGIN@678 which was called:
# once (6µs+7µs) by Moose::Meta::Attribute::BEGIN@24 at line 678 # spent 13µs making 1 call to Moose::Util::TypeConstraints::BEGIN@678
# spent 7µs making 1 call to warnings::unimport |
679 | 1 | 600ns | my $given = shift; | ||
680 | 1 | 100ns | my @rv; | ||
681 | 1 | 68µs | 2 | 60µs | while ( $given =~ m{ \G (?: $op_union )? ($type) }gcx ) { # spent 57µs making 1 call to Moose::Util::TypeConstraints::CORE:regcomp
# spent 3µs making 1 call to Moose::Util::TypeConstraints::CORE:match |
682 | 2 | 17µs | 4 | 7µs | push @rv => $1; # spent 5µs making 2 calls to Moose::Util::TypeConstraints::CORE:regcomp, avg 3µs/call
# spent 2µs making 2 calls to Moose::Util::TypeConstraints::CORE:match, avg 1µs/call |
683 | } | ||||
684 | 1 | 1µs | ( pos($given) eq length($given) ) | ||
685 | || __PACKAGE__->_throw_error( "'$given' didn't parse (parse-pos=" | ||||
686 | . pos($given) | ||||
687 | . " and str-length=" | ||||
688 | . length($given) | ||||
689 | . ")" ); | ||||
690 | 1 | 4µs | @rv; | ||
691 | } | ||||
692 | |||||
693 | # spent 180µs (33+147) within Moose::Util::TypeConstraints::_detect_type_constraint_union which was called 6 times, avg 30µs/call:
# 5 times (29µs+140µs) by Moose::Util::TypeConstraints::find_or_parse_type_constraint at line 274, avg 34µs/call
# once (4µs+7µs) by Moose::Util::TypeConstraints::_create_type_constraint_union at line 93 | ||||
694 | 14 | 269µs | 2 | 20µs | # spent 14µs (6+7) within Moose::Util::TypeConstraints::BEGIN@694 which was called:
# once (6µs+7µs) by Moose::Meta::Attribute::BEGIN@24 at line 694 # spent 14µs making 1 call to Moose::Util::TypeConstraints::BEGIN@694
# spent 7µs making 1 call to warnings::unimport |
695 | 6 | 181µs | 12 | 147µs | $_[0] =~ m{^ $type $op_union $type ( $op_union .* )? $}x; # spent 139µs making 6 calls to Moose::Util::TypeConstraints::CORE:regcomp, avg 23µs/call
# spent 8µs making 6 calls to Moose::Util::TypeConstraints::CORE:match, avg 1µs/call |
696 | } | ||||
697 | } | ||||
698 | |||||
699 | ## -------------------------------------------------------- | ||||
700 | # define some basic built-in types | ||||
701 | ## -------------------------------------------------------- | ||||
702 | |||||
703 | # By making these classes immutable before creating all the types in | ||||
704 | # Moose::Util::TypeConstraints::Builtin , we avoid repeatedly calling the slow | ||||
705 | # MOP-based accessors. | ||||
706 | $_->make_immutable( | ||||
707 | 9 | 6µs | 9 | 5µs | inline_constructor => 1, # spent 5µs making 9 calls to Class::MOP::Class::is_mutable, avg 511ns/call |
708 | constructor_name => "_new", | ||||
709 | |||||
710 | # these are Class::MOP accessors, so they need inlining | ||||
711 | inline_accessors => 1 | ||||
712 | 10 | 19µs | 18 | 30.5ms | ) for grep { $_->is_mutable } # spent 30.4ms making 9 calls to Class::MOP::Class::make_immutable, avg 3.38ms/call
# spent 23µs making 9 calls to Class::MOP::class_of, avg 3µs/call |
713 | map { Class::MOP::class_of($_) } | ||||
714 | qw( | ||||
715 | Moose::Meta::TypeConstraint | ||||
716 | Moose::Meta::TypeConstraint::Union | ||||
717 | Moose::Meta::TypeConstraint::Parameterized | ||||
718 | Moose::Meta::TypeConstraint::Parameterizable | ||||
719 | Moose::Meta::TypeConstraint::Class | ||||
720 | Moose::Meta::TypeConstraint::Role | ||||
721 | Moose::Meta::TypeConstraint::Enum | ||||
722 | Moose::Meta::TypeConstraint::DuckType | ||||
723 | Moose::Meta::TypeConstraint::Registry | ||||
724 | ); | ||||
725 | |||||
726 | 1 | 80µs | require Moose::Util::TypeConstraints::Builtins; | ||
727 | 1 | 2µs | 1 | 6.53ms | Moose::Util::TypeConstraints::Builtins::define_builtins($REGISTRY); # spent 6.53ms making 1 call to Moose::Util::TypeConstraints::Builtins::define_builtins |
728 | |||||
729 | my @PARAMETERIZABLE_TYPES | ||||
730 | 5 | 5µs | 4 | 14µs | = map { $REGISTRY->get_type_constraint($_) } qw[ScalarRef ArrayRef HashRef Maybe]; # spent 14µs making 4 calls to Moose::Meta::TypeConstraint::Registry::get_type_constraint, avg 3µs/call |
731 | |||||
732 | 3 | 7µs | # spent 6µs within Moose::Util::TypeConstraints::get_all_parameterizable_types which was called 3 times, avg 2µs/call:
# 3 times (6µs+0s) by Moose::Meta::TypeConstraint::Parameterized::compile_type_constraint at line 60 of Moose/Meta/TypeConstraint/Parameterized.pm, avg 2µs/call | ||
733 | |||||
734 | sub add_parameterizable_type { | ||||
735 | my $type = shift; | ||||
736 | ( blessed $type | ||||
737 | && $type->isa('Moose::Meta::TypeConstraint::Parameterizable') ) | ||||
738 | || __PACKAGE__->_throw_error( | ||||
739 | "Type must be a Moose::Meta::TypeConstraint::Parameterizable not $type" | ||||
740 | ); | ||||
741 | push @PARAMETERIZABLE_TYPES => $type; | ||||
742 | } | ||||
743 | |||||
744 | ## -------------------------------------------------------- | ||||
745 | # end of built-in types ... | ||||
746 | ## -------------------------------------------------------- | ||||
747 | |||||
748 | { | ||||
749 | 2 | 3µs | 1 | 6µs | my @BUILTINS = list_all_type_constraints(); # spent 6µs making 1 call to Moose::Util::TypeConstraints::list_all_type_constraints |
750 | sub list_all_builtin_type_constraints {@BUILTINS} | ||||
751 | } | ||||
752 | |||||
753 | sub _throw_error { | ||||
754 | shift; | ||||
755 | require Moose; | ||||
756 | unshift @_, 'Moose'; | ||||
757 | goto &Moose::throw_error; | ||||
758 | } | ||||
759 | |||||
760 | 1 | 32µs | 1; | ||
761 | |||||
762 | # ABSTRACT: Type constraint system for Moose | ||||
763 | |||||
764 | __END__ | ||||
# spent 61µs within Moose::Util::TypeConstraints::CORE:match which was called 33 times, avg 2µs/call:
# 17 times (26µs+0s) by Moose::Util::TypeConstraints::_create_type_constraint at line 549, avg 2µs/call
# 6 times (8µs+0s) by Moose::Util::TypeConstraints::_detect_type_constraint_union at line 695, avg 1µs/call
# 4 times (12µs+0s) by Moose::Util::TypeConstraints::_detect_parameterized_type_constraint at line 674, avg 3µs/call
# 3 times (10µs+0s) by Moose::Util::TypeConstraints::_parse_parameterized_type_constraint at line 668, avg 3µs/call
# 2 times (2µs+0s) by Moose::Util::TypeConstraints::_parse_type_constraint_union at line 682, avg 1µs/call
# once (3µs+0s) by Moose::Util::TypeConstraints::_parse_type_constraint_union at line 681 | |||||
# spent 12µs within Moose::Util::TypeConstraints::CORE:qr which was called 10 times, avg 1µs/call:
# once (3µs+0s) by Moose::Meta::Attribute::BEGIN@24 at line 619
# once (1µs+0s) by Moose::Meta::Attribute::BEGIN@24 at line 616
# once (900ns+0s) by Moose::Meta::Attribute::BEGIN@24 at line 634
# once (900ns+0s) by Moose::Meta::Attribute::BEGIN@24 at line 650
# once (900ns+0s) by Moose::Meta::Attribute::BEGIN@24 at line 617
# once (900ns+0s) by Moose::Meta::Attribute::BEGIN@24 at line 647
# once (900ns+0s) by Moose::Meta::Attribute::BEGIN@24 at line 649
# once (900ns+0s) by Moose::Meta::Attribute::BEGIN@24 at line 646
# once (900ns+0s) by Moose::Meta::Attribute::BEGIN@24 at line 648
# once (700ns+0s) by Moose::Meta::Attribute::BEGIN@24 at line 618 | |||||
# spent 583µs within Moose::Util::TypeConstraints::CORE:regcomp which was called 24 times, avg 24µs/call:
# 6 times (139µs+0s) by Moose::Util::TypeConstraints::_detect_type_constraint_union at line 695, avg 23µs/call
# 4 times (54µs+0s) by Moose::Util::TypeConstraints::_detect_parameterized_type_constraint at line 674, avg 14µs/call
# 3 times (53µs+0s) by Moose::Util::TypeConstraints::_parse_parameterized_type_constraint at line 668, avg 18µs/call
# 2 times (5µs+0s) by Moose::Util::TypeConstraints::_parse_type_constraint_union at line 682, avg 3µs/call
# once (57µs+0s) by Moose::Util::TypeConstraints::_parse_type_constraint_union at line 681
# once (51µs+0s) by Moose::Meta::Attribute::BEGIN@24 at line 634
# once (44µs+0s) by Moose::Meta::Attribute::BEGIN@24 at line 646
# once (42µs+0s) by Moose::Meta::Attribute::BEGIN@24 at line 647
# once (41µs+0s) by Moose::Meta::Attribute::BEGIN@24 at line 649
# once (39µs+0s) by Moose::Meta::Attribute::BEGIN@24 at line 648
# once (37µs+0s) by Moose::Meta::Attribute::BEGIN@24 at line 650
# once (13µs+0s) by Moose::Meta::Attribute::BEGIN@24 at line 617
# once (7µs+0s) by Moose::Meta::Attribute::BEGIN@24 at line 619 | |||||
# spent 33µs within Moose::Util::TypeConstraints::CORE:subst which was called 53 times, avg 615ns/call:
# 53 times (33µs+0s) by Moose::Util::TypeConstraints::normalize_type_constraint_name at line 294, avg 615ns/call |