| Filename | /home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Moose/Meta/TypeConstraint/Parameterized.pm |
| Statements | Executed 91 statements in 3.62ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 2.29ms | 9.27ms | Moose::Meta::TypeConstraint::Parameterized::BEGIN@9 |
| 6 | 1 | 1 | 1.13ms | 24.6ms | Moose::Meta::TypeConstraint::Parameterized::compile_type_constraint |
| 1 | 1 | 1 | 200µs | 227µs | Moose::Meta::TypeConstraint::Parameterized::BEGIN@3 |
| 3 | 1 | 1 | 125µs | 285µs | Moose::Meta::TypeConstraint::Parameterized::equals |
| 1 | 1 | 1 | 62µs | 160µs | Moose::Meta::TypeConstraint::Parameterized::BEGIN@4 |
| 1 | 1 | 1 | 59µs | 300µs | Moose::Meta::TypeConstraint::Parameterized::BEGIN@15 |
| 1 | 1 | 1 | 46µs | 3.50ms | Moose::Meta::TypeConstraint::Parameterized::BEGIN@5 |
| 1 | 1 | 1 | 44µs | 44µs | Moose::Meta::TypeConstraint::Parameterized::BEGIN@8 |
| 1 | 1 | 1 | 41µs | 203µs | Moose::Meta::TypeConstraint::Parameterized::BEGIN@7 |
| 0 | 0 | 0 | 0s | 0s | Moose::Meta::TypeConstraint::Parameterized::create_child_type |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package Moose::Meta::TypeConstraint::Parameterized; | ||||
| 2 | |||||
| 3 | 3 | 178µs | 2 | 254µs | # spent 227µs (200+27) within Moose::Meta::TypeConstraint::Parameterized::BEGIN@3 which was called:
# once (200µs+27µs) by Moose::Util::TypeConstraints::BEGIN@31 at line 3 # spent 227µs making 1 call to Moose::Meta::TypeConstraint::Parameterized::BEGIN@3
# spent 27µs making 1 call to strict::import |
| 4 | 3 | 144µs | 2 | 258µs | # spent 160µs (62+98) within Moose::Meta::TypeConstraint::Parameterized::BEGIN@4 which was called:
# once (62µs+98µs) by Moose::Util::TypeConstraints::BEGIN@31 at line 4 # spent 160µs making 1 call to Moose::Meta::TypeConstraint::Parameterized::BEGIN@4
# spent 98µs making 1 call to warnings::import |
| 5 | 3 | 159µs | 2 | 6.95ms | # spent 3.50ms (46µs+3.45) within Moose::Meta::TypeConstraint::Parameterized::BEGIN@5 which was called:
# once (46µs+3.45ms) by Moose::Util::TypeConstraints::BEGIN@31 at line 5 # spent 3.50ms making 1 call to Moose::Meta::TypeConstraint::Parameterized::BEGIN@5
# spent 3.45ms making 1 call to metaclass::import |
| 6 | |||||
| 7 | 3 | 122µs | 2 | 365µs | # spent 203µs (41+162) within Moose::Meta::TypeConstraint::Parameterized::BEGIN@7 which was called:
# once (41µs+162µs) by Moose::Util::TypeConstraints::BEGIN@31 at line 7 # spent 203µs making 1 call to Moose::Meta::TypeConstraint::Parameterized::BEGIN@7
# spent 162µs making 1 call to Exporter::import |
| 8 | 3 | 107µs | 1 | 44µs | # spent 44µs within Moose::Meta::TypeConstraint::Parameterized::BEGIN@8 which was called:
# once (44µs+0s) by Moose::Util::TypeConstraints::BEGIN@31 at line 8 # spent 44µs making 1 call to Moose::Meta::TypeConstraint::Parameterized::BEGIN@8 |
| 9 | 3 | 649µs | 1 | 9.27ms | # spent 9.27ms (2.29+6.97) within Moose::Meta::TypeConstraint::Parameterized::BEGIN@9 which was called:
# once (2.29ms+6.97ms) by Moose::Util::TypeConstraints::BEGIN@31 at line 9 # spent 9.27ms making 1 call to Moose::Meta::TypeConstraint::Parameterized::BEGIN@9 |
| 10 | |||||
| 11 | 1 | 5µs | our $VERSION = '1.19'; | ||
| 12 | 1 | 71µs | $VERSION = eval $VERSION; # spent 11µs executing statements in string eval | ||
| 13 | 1 | 3µs | our $AUTHORITY = 'cpan:STEVAN'; | ||
| 14 | |||||
| 15 | 3 | 971µs | 2 | 540µs | # spent 300µs (59+240) within Moose::Meta::TypeConstraint::Parameterized::BEGIN@15 which was called:
# once (59µs+240µs) by Moose::Util::TypeConstraints::BEGIN@31 at line 15 # spent 300µs making 1 call to Moose::Meta::TypeConstraint::Parameterized::BEGIN@15
# spent 240µs making 1 call to base::import |
| 16 | |||||
| 17 | 1 | 27µs | 2 | 3.24ms | __PACKAGE__->meta->add_attribute('type_parameter' => ( # spent 3.13ms making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute
# spent 114µs making 1 call to Moose::Meta::TypeConstraint::Parameterized::meta |
| 18 | accessor => 'type_parameter', | ||||
| 19 | predicate => 'has_type_parameter', | ||||
| 20 | )); | ||||
| 21 | |||||
| 22 | # spent 285µs (125+160) within Moose::Meta::TypeConstraint::Parameterized::equals which was called 3 times, avg 95µs/call:
# 3 times (125µs+160µs) by Moose::Meta::TypeConstraint::is_a_type_of at line 180 of Moose/Meta/TypeConstraint.pm, avg 95µs/call | ||||
| 23 | 3 | 13µs | my ( $self, $type_or_name ) = @_; | ||
| 24 | |||||
| 25 | 3 | 28µs | 3 | 121µs | my $other = Moose::Util::TypeConstraints::find_type_constraint($type_or_name); # spent 121µs making 3 calls to Moose::Util::TypeConstraints::find_type_constraint, avg 40µs/call |
| 26 | |||||
| 27 | 3 | 112µs | 3 | 39µs | return unless $other->isa(__PACKAGE__); # spent 39µs making 3 calls to UNIVERSAL::isa, avg 13µs/call |
| 28 | |||||
| 29 | return ( | ||||
| 30 | $self->type_parameter->equals( $other->type_parameter ) | ||||
| 31 | and | ||||
| 32 | $self->parent->equals( $other->parent ) | ||||
| 33 | ); | ||||
| 34 | } | ||||
| 35 | |||||
| 36 | # spent 24.6ms (1.13+23.5) within Moose::Meta::TypeConstraint::Parameterized::compile_type_constraint which was called 6 times, avg 4.11ms/call:
# 6 times (1.13ms+23.5ms) by Moose::Meta::TypeConstraint::new at line 71 of Moose/Meta/TypeConstraint.pm, avg 4.11ms/call | ||||
| 37 | 6 | 20µs | my $self = shift; | ||
| 38 | |||||
| 39 | 6 | 65µs | 6 | 63µs | unless ( $self->has_type_parameter ) { # spent 63µs making 6 calls to Moose::Meta::TypeConstraint::Parameterized::has_type_parameter, avg 10µs/call |
| 40 | require Moose; | ||||
| 41 | Moose->throw_error("You cannot create a Higher Order type without a type parameter"); | ||||
| 42 | } | ||||
| 43 | |||||
| 44 | 6 | 71µs | 6 | 77µs | my $type_parameter = $self->type_parameter; # spent 77µs making 6 calls to Moose::Meta::TypeConstraint::Parameterized::type_parameter, avg 13µs/call |
| 45 | |||||
| 46 | 6 | 166µs | 12 | 580µs | unless ( blessed $type_parameter && $type_parameter->isa('Moose::Meta::TypeConstraint') ) { # spent 539µs making 6 calls to MooseX::Types::TypeDecorator::isa, avg 90µs/call
# spent 41µs making 6 calls to Scalar::Util::blessed, avg 7µs/call |
| 47 | require Moose; | ||||
| 48 | Moose->throw_error("The type parameter must be a Moose meta type"); | ||||
| 49 | } | ||||
| 50 | |||||
| 51 | 6 | 82µs | 6 | 67µs | foreach my $type (Moose::Util::TypeConstraints::get_all_parameterizable_types()) { # spent 67µs making 6 calls to Moose::Util::TypeConstraints::get_all_parameterizable_types, avg 11µs/call |
| 52 | 14 | 187µs | 14 | 19.5ms | if (my $constraint = $type->generate_constraint_for($self)) { # spent 19.5ms making 14 calls to Moose::Meta::TypeConstraint::Parameterizable::generate_constraint_for, avg 1.39ms/call |
| 53 | 6 | 88µs | 6 | 73µs | $self->_set_constraint($constraint); # spent 73µs making 6 calls to Moose::Meta::TypeConstraint::_set_constraint, avg 12µs/call |
| 54 | 6 | 324µs | 6 | 3.20ms | return $self->SUPER::compile_type_constraint; # spent 3.20ms making 6 calls to Moose::Meta::TypeConstraint::compile_type_constraint, avg 534µs/call |
| 55 | } | ||||
| 56 | } | ||||
| 57 | |||||
| 58 | # if we get here, then we couldn't | ||||
| 59 | # find a way to parameterize this type | ||||
| 60 | require Moose; | ||||
| 61 | Moose->throw_error("The " . $self->name . " constraint cannot be used, because " | ||||
| 62 | . $self->parent->name . " doesn't subtype or coerce from a parameterizable type."); | ||||
| 63 | } | ||||
| 64 | |||||
| 65 | sub create_child_type { | ||||
| 66 | my ($self, %opts) = @_; | ||||
| 67 | return Moose::Meta::TypeConstraint::Parameterizable->new(%opts, parent=>$self); | ||||
| 68 | } | ||||
| 69 | |||||
| 70 | 1 | 27µs | 1; | ||
| 71 | |||||
| 72 | __END__ |