| Filename | /home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Moose/Meta/Role/Attribute.pm |
| Statements | Executed 262 statements in 7.19ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 21 | 1 | 1 | 1.32ms | 95.7ms | Moose::Meta::Role::Attribute::attribute_for_class |
| 24 | 2 | 2 | 1.14ms | 1.14ms | Moose::Meta::Role::Attribute::new |
| 24 | 1 | 1 | 1.01ms | 1.41ms | Moose::Meta::Role::Attribute::attach_to_role |
| 15 | 1 | 1 | 804µs | 1.79ms | Moose::Meta::Role::Attribute::clone |
| 1 | 1 | 1 | 74µs | 92µs | Moose::Meta::Role::Attribute::BEGIN@3 |
| 1 | 1 | 1 | 49µs | 122µs | Moose::Meta::Role::Attribute::BEGIN@4 |
| 1 | 1 | 1 | 40µs | 300µs | Moose::Meta::Role::Attribute::BEGIN@13 |
| 1 | 1 | 1 | 39µs | 199µs | Moose::Meta::Role::Attribute::BEGIN@8 |
| 1 | 1 | 1 | 38µs | 203µs | Moose::Meta::Role::Attribute::BEGIN@7 |
| 1 | 1 | 1 | 37µs | 201µs | Moose::Meta::Role::Attribute::BEGIN@6 |
| 0 | 0 | 0 | 0s | 0s | Moose::Meta::Role::Attribute::__ANON__[:90] |
| 0 | 0 | 0 | 0s | 0s | Moose::Meta::Role::Attribute::is_same_as |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package Moose::Meta::Role::Attribute; | ||||
| 2 | |||||
| 3 | 3 | 126µs | 2 | 110µs | # spent 92µs (74+18) within Moose::Meta::Role::Attribute::BEGIN@3 which was called:
# once (74µs+18µs) by Moose::Meta::Role::BEGIN@17 at line 3 # spent 92µs making 1 call to Moose::Meta::Role::Attribute::BEGIN@3
# spent 18µs making 1 call to strict::import |
| 4 | 3 | 129µs | 2 | 195µs | # spent 122µs (49+73) within Moose::Meta::Role::Attribute::BEGIN@4 which was called:
# once (49µs+73µs) by Moose::Meta::Role::BEGIN@17 at line 4 # spent 122µs making 1 call to Moose::Meta::Role::Attribute::BEGIN@4
# spent 73µs making 1 call to warnings::import |
| 5 | |||||
| 6 | 3 | 105µs | 2 | 366µs | # spent 201µs (37+164) within Moose::Meta::Role::Attribute::BEGIN@6 which was called:
# once (37µs+164µs) by Moose::Meta::Role::BEGIN@17 at line 6 # spent 201µs making 1 call to Moose::Meta::Role::Attribute::BEGIN@6
# spent 164µs making 1 call to Exporter::import |
| 7 | 3 | 112µs | 2 | 368µs | # spent 203µs (38+165) within Moose::Meta::Role::Attribute::BEGIN@7 which was called:
# once (38µs+165µs) by Moose::Meta::Role::BEGIN@17 at line 7 # spent 203µs making 1 call to Moose::Meta::Role::Attribute::BEGIN@7
# spent 165µs making 1 call to Exporter::import |
| 8 | 3 | 191µs | 2 | 360µs | # spent 199µs (39+161) within Moose::Meta::Role::Attribute::BEGIN@8 which was called:
# once (39µs+161µs) by Moose::Meta::Role::BEGIN@17 at line 8 # spent 199µs making 1 call to Moose::Meta::Role::Attribute::BEGIN@8
# spent 160µs making 1 call to Exporter::import |
| 9 | |||||
| 10 | 1 | 5µs | our $VERSION = '1.19'; | ||
| 11 | 1 | 3µs | our $AUTHORITY = 'cpan:STEVAN'; | ||
| 12 | |||||
| 13 | 3 | 1.42ms | 2 | 560µs | # spent 300µs (40+260) within Moose::Meta::Role::Attribute::BEGIN@13 which was called:
# once (40µs+260µs) by Moose::Meta::Role::BEGIN@17 at line 13 # spent 300µs making 1 call to Moose::Meta::Role::Attribute::BEGIN@13
# spent 260µs making 1 call to base::import |
| 14 | |||||
| 15 | 1 | 52µs | 2 | 4.28ms | __PACKAGE__->meta->add_attribute( # spent 2.19ms making 1 call to Class::MOP::Mixin::meta
# spent 2.09ms making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute |
| 16 | 'metaclass' => ( | ||||
| 17 | reader => 'metaclass', | ||||
| 18 | ) | ||||
| 19 | ); | ||||
| 20 | |||||
| 21 | 1 | 24µs | 2 | 2.14ms | __PACKAGE__->meta->add_attribute( # spent 2.06ms making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute
# spent 86µs making 1 call to Class::MOP::Mixin::meta |
| 22 | 'associated_role' => ( | ||||
| 23 | reader => 'associated_role', | ||||
| 24 | ) | ||||
| 25 | ); | ||||
| 26 | |||||
| 27 | 1 | 24µs | 2 | 2.14ms | __PACKAGE__->meta->add_attribute( # spent 2.06ms making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute
# spent 86µs making 1 call to Class::MOP::Mixin::meta |
| 28 | 'is' => ( | ||||
| 29 | reader => 'is', | ||||
| 30 | ) | ||||
| 31 | ); | ||||
| 32 | |||||
| 33 | 1 | 23µs | 2 | 2.11ms | __PACKAGE__->meta->add_attribute( # spent 2.02ms making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute
# spent 85µs making 1 call to Class::MOP::Mixin::meta |
| 34 | 'original_options' => ( | ||||
| 35 | reader => 'original_options', | ||||
| 36 | ) | ||||
| 37 | ); | ||||
| 38 | |||||
| 39 | # spent 1.14ms within Moose::Meta::Role::Attribute::new which was called 24 times, avg 48µs/call:
# 15 times (717µs+0s) by Moose::Meta::Role::Attribute::clone at line 73, avg 48µs/call
# 9 times (428µs+0s) by Class::MOP::Mixin::HasAttributes::add_attribute at line 21 of Class/MOP/Mixin/HasAttributes.pm, avg 48µs/call | ||||
| 40 | 72 | 1.21ms | my ( $class, $name, %options ) = @_; | ||
| 41 | |||||
| 42 | (defined $name) | ||||
| 43 | || confess "You must provide a name for the attribute"; | ||||
| 44 | |||||
| 45 | return bless { | ||||
| 46 | name => $name, | ||||
| 47 | original_options => \%options, | ||||
| 48 | %options, | ||||
| 49 | }, $class; | ||||
| 50 | } | ||||
| 51 | |||||
| 52 | # spent 1.41ms (1.01+393µs) within Moose::Meta::Role::Attribute::attach_to_role which was called 24 times, avg 59µs/call:
# 24 times (1.01ms+393µs) by Moose::Meta::Role::_attach_attribute at line 246 of Moose/Meta/Role.pm, avg 59µs/call | ||||
| 53 | 72 | 1.45ms | my ( $self, $role ) = @_; | ||
| 54 | |||||
| 55 | 48 | 247µs | ( blessed($role) && $role->isa('Moose::Meta::Role') ) # spent 128µs making 24 calls to Scalar::Util::blessed, avg 5µs/call
# spent 120µs making 24 calls to UNIVERSAL::isa, avg 5µs/call | ||
| 56 | || confess | ||||
| 57 | "You must pass a Moose::Meta::Role instance (or a subclass)"; | ||||
| 58 | |||||
| 59 | 24 | 146µs | weaken( $self->{'associated_role'} = $role ); # spent 146µs making 24 calls to Scalar::Util::weaken, avg 6µs/call | ||
| 60 | } | ||||
| 61 | |||||
| 62 | # spent 95.7ms (1.32+94.4) within Moose::Meta::Role::Attribute::attribute_for_class which was called 21 times, avg 4.56ms/call:
# 21 times (1.32ms+94.4ms) by Moose::Meta::Role::Application::ToClass::apply_attributes at line 142 of Moose/Meta/Role/Application/ToClass.pm, avg 4.56ms/call | ||||
| 63 | 63 | 1.44ms | my $self = shift; | ||
| 64 | my $metaclass = shift; | ||||
| 65 | |||||
| 66 | return $metaclass->interpolate_class_and_new( | ||||
| 67 | 63 | 73.9ms | $self->name => %{ $self->original_options } ); # spent 94.0ms making 21 calls to Moose::Meta::Attribute::interpolate_class_and_new, avg 4.47ms/call, recursion: max depth 1, sum of overlapping time 20.5ms
# spent 272µs making 21 calls to Moose::Meta::Role::Attribute::original_options, avg 13µs/call
# spent 175µs making 21 calls to Class::MOP::Mixin::AttributeCore::name, avg 8µs/call | ||
| 68 | } | ||||
| 69 | |||||
| 70 | # spent 1.79ms (804µs+982µs) within Moose::Meta::Role::Attribute::clone which was called 15 times, avg 119µs/call:
# 15 times (804µs+982µs) by Moose::Meta::Role::Application::ToRole::apply_attributes at line 71 of Moose/Meta/Role/Application/ToRole.pm, avg 119µs/call | ||||
| 71 | 30 | 841µs | my $self = shift; | ||
| 72 | |||||
| 73 | 45 | 982µs | return ( ref $self )->new( $self->name, %{ $self->original_options } ); # spent 717µs making 15 calls to Moose::Meta::Role::Attribute::new, avg 48µs/call
# spent 181µs making 15 calls to Moose::Meta::Role::Attribute::original_options, avg 12µs/call
# spent 84µs making 15 calls to Class::MOP::Mixin::AttributeCore::name, avg 6µs/call | ||
| 74 | } | ||||
| 75 | |||||
| 76 | sub is_same_as { | ||||
| 77 | my $self = shift; | ||||
| 78 | my $attr = shift; | ||||
| 79 | |||||
| 80 | my $self_options = $self->original_options; | ||||
| 81 | my $other_options = $attr->original_options; | ||||
| 82 | |||||
| 83 | return 0 | ||||
| 84 | unless ( join q{|}, sort keys %{$self_options} ) eq ( join q{|}, sort keys %{$other_options} ); | ||||
| 85 | |||||
| 86 | for my $key ( keys %{$self_options} ) { | ||||
| 87 | return 0 if defined $self_options->{$key} && ! defined $other_options->{$key}; | ||||
| 88 | return 0 if ! defined $self_options->{$key} && defined $other_options->{$key}; | ||||
| 89 | |||||
| 90 | next if all { ! defined } $self_options->{$key}, $other_options->{$key}; | ||||
| 91 | |||||
| 92 | return 0 unless $self_options->{$key} eq $other_options->{$key}; | ||||
| 93 | } | ||||
| 94 | |||||
| 95 | return 1; | ||||
| 96 | } | ||||
| 97 | |||||
| 98 | 1 | 33µs | 1; | ||
| 99 | |||||
| 100 | =pod | ||||
| 101 | |||||
| - - |