| Filename | /Users/ap13/perl5/lib/perl5/darwin-2level/Moose/Role.pm |
| Statements | Executed 201 statements in 1.36ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 26 | 14 | 4 | 262µs | 2.66ms | Moose::Role::has |
| 3 | 1 | 1 | 153µs | 4.76ms | Moose::Role::init_meta |
| 1 | 1 | 1 | 30µs | 52µs | Bio::Roary::ClustersRole::BEGIN@1 |
| 1 | 1 | 1 | 19µs | 37µs | Moose::Role::BEGIN@9 |
| 1 | 1 | 1 | 14µs | 74µs | Moose::Role::BEGIN@8 |
| 1 | 1 | 1 | 13µs | 23µs | Bio::Roary::ClustersRole::BEGIN@2 |
| 1 | 1 | 1 | 10µs | 155µs | Moose::Role::BEGIN@11 |
| 1 | 1 | 1 | 9µs | 6.19ms | Moose::Role::BEGIN@18 |
| 1 | 1 | 1 | 9µs | 35µs | Moose::Role::BEGIN@16 |
| 1 | 1 | 1 | 9µs | 176µs | Moose::Role::BEGIN@14 |
| 1 | 1 | 1 | 6µs | 6µs | Moose::Role::BEGIN@17 |
| 1 | 1 | 1 | 6µs | 6µs | Moose::Role::BEGIN@6 |
| 1 | 1 | 1 | 5µs | 5µs | Moose::Role::BEGIN@7 |
| 1 | 1 | 1 | 4µs | 4µs | Moose::Role::BEGIN@13 |
| 0 | 0 | 0 | 0s | 0s | Moose::Role::_add_method_modifier |
| 0 | 0 | 0 | 0s | 0s | Moose::Role::after |
| 0 | 0 | 0 | 0s | 0s | Moose::Role::around |
| 0 | 0 | 0 | 0s | 0s | Moose::Role::augment |
| 0 | 0 | 0 | 0s | 0s | Moose::Role::before |
| 0 | 0 | 0 | 0s | 0s | Moose::Role::excludes |
| 0 | 0 | 0 | 0s | 0s | Moose::Role::extends |
| 0 | 0 | 0 | 0s | 0s | Moose::Role::inner |
| 0 | 0 | 0 | 0s | 0s | Moose::Role::override |
| 0 | 0 | 0 | 0s | 0s | Moose::Role::requires |
| 0 | 0 | 0 | 0s | 0s | Moose::Role::super |
| 0 | 0 | 0 | 0s | 0s | Moose::Role::with |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | 2 | 45µs | 2 | 75µs | # spent 52µs (30+23) within Bio::Roary::ClustersRole::BEGIN@1 which was called:
# once (30µs+23µs) by Bio::Roary::ClustersRole::BEGIN@11 at line 1 # spent 52µs making 1 call to Bio::Roary::ClustersRole::BEGIN@1
# spent 23µs making 1 call to strict::import |
| 2 | 2 | 58µs | 2 | 33µs | # spent 23µs (13+10) within Bio::Roary::ClustersRole::BEGIN@2 which was called:
# once (13µs+10µs) by Bio::Roary::ClustersRole::BEGIN@11 at line 2 # spent 23µs making 1 call to Bio::Roary::ClustersRole::BEGIN@2
# spent 10µs making 1 call to warnings::import |
| 3 | package Moose::Role; | ||||
| 4 | 1 | 700ns | our $VERSION = '2.1403'; | ||
| 5 | |||||
| 6 | 2 | 37µs | 1 | 6µs | # spent 6µs within Moose::Role::BEGIN@6 which was called:
# once (6µs+0s) by Bio::Roary::ClustersRole::BEGIN@11 at line 6 # spent 6µs making 1 call to Moose::Role::BEGIN@6 |
| 7 | 2 | 32µs | 1 | 5µs | # spent 5µs within Moose::Role::BEGIN@7 which was called:
# once (5µs+0s) by Bio::Roary::ClustersRole::BEGIN@11 at line 7 # spent 5µs making 1 call to Moose::Role::BEGIN@7 |
| 8 | 2 | 41µs | 2 | 134µs | # spent 74µs (14+60) within Moose::Role::BEGIN@8 which was called:
# once (14µs+60µs) by Bio::Roary::ClustersRole::BEGIN@11 at line 8 # spent 74µs making 1 call to Moose::Role::BEGIN@8
# spent 60µs making 1 call to Exporter::import |
| 9 | 2 | 34µs | 2 | 55µs | # spent 37µs (19+18) within Moose::Role::BEGIN@9 which was called:
# once (19µs+18µs) by Bio::Roary::ClustersRole::BEGIN@11 at line 9 # spent 37µs making 1 call to Moose::Role::BEGIN@9
# spent 18µs making 1 call to Module::Runtime::import |
| 10 | |||||
| 11 | 2 | 27µs | 2 | 299µs | # spent 155µs (10+144) within Moose::Role::BEGIN@11 which was called:
# once (10µs+144µs) by Bio::Roary::ClustersRole::BEGIN@11 at line 11 # spent 155µs making 1 call to Moose::Role::BEGIN@11
# spent 144µs making 1 call to Sub::Exporter::__ANON__[Sub/Exporter.pm:337] |
| 12 | |||||
| 13 | 2 | 21µs | 1 | 4µs | # spent 4µs within Moose::Role::BEGIN@13 which was called:
# once (4µs+0s) by Bio::Roary::ClustersRole::BEGIN@11 at line 13 # spent 4µs making 1 call to Moose::Role::BEGIN@13 |
| 14 | 2 | 28µs | 2 | 344µs | # spent 176µs (9+167) within Moose::Role::BEGIN@14 which was called:
# once (9µs+167µs) by Bio::Roary::ClustersRole::BEGIN@11 at line 14 # spent 176µs making 1 call to Moose::Role::BEGIN@14
# spent 167µs making 1 call to Sub::Exporter::__ANON__[Sub/Exporter.pm:337] |
| 15 | |||||
| 16 | 2 | 24µs | 2 | 62µs | # spent 35µs (9+26) within Moose::Role::BEGIN@16 which was called:
# once (9µs+26µs) by Bio::Roary::ClustersRole::BEGIN@11 at line 16 # spent 35µs making 1 call to Moose::Role::BEGIN@16
# spent 26µs making 1 call to Moose::Exporter::import |
| 17 | 2 | 21µs | 1 | 6µs | # spent 6µs within Moose::Role::BEGIN@17 which was called:
# once (6µs+0s) by Bio::Roary::ClustersRole::BEGIN@11 at line 17 # spent 6µs making 1 call to Moose::Role::BEGIN@17 |
| 18 | 2 | 660µs | 2 | 12.4ms | # spent 6.19ms (9µs+6.18) within Moose::Role::BEGIN@18 which was called:
# once (9µs+6.18ms) by Bio::Roary::ClustersRole::BEGIN@11 at line 18 # spent 6.19ms making 1 call to Moose::Role::BEGIN@18
# spent 6.18ms making 1 call to Moose::Util::TypeConstraints::import |
| 19 | |||||
| 20 | sub extends { | ||||
| 21 | throw_exception("RolesDoNotSupportExtends"); | ||||
| 22 | } | ||||
| 23 | |||||
| 24 | sub with { | ||||
| 25 | Moose::Util::apply_all_roles( shift, @_ ); | ||||
| 26 | } | ||||
| 27 | |||||
| 28 | sub requires { | ||||
| 29 | my $meta = shift; | ||||
| 30 | throw_exception( MustSpecifyAtleastOneMethod => role_name => $meta->name ) unless @_; | ||||
| 31 | $meta->add_required_methods(@_); | ||||
| 32 | } | ||||
| 33 | |||||
| 34 | sub excludes { | ||||
| 35 | my $meta = shift; | ||||
| 36 | throw_exception( MustSpecifyAtleastOneRole => role_name => $meta->name ) unless @_; | ||||
| 37 | $meta->add_excluded_roles(@_); | ||||
| 38 | } | ||||
| 39 | |||||
| 40 | # spent 2.66ms (262µs+2.40) within Moose::Role::has which was called 26 times, avg 102µs/call:
# 13 times (186µs+1.06ms) by Moose::Role::has at line 419 of Moose/Exporter.pm, avg 96µs/call
# once (11µs+209µs) by Module::Runtime::require_module at line 14 of lib/Bio/Roary/ClustersRole.pm
# once (8µs+151µs) by Module::Runtime::require_module at line 13 of lib/Bio/Roary/ParseGFFAnnotationRole.pm
# once (8µs+138µs) by Module::Runtime::require_module at line 14 of lib/Bio/Roary/JobRunner/Role.pm
# once (5µs+99µs) by Module::Runtime::require_module at line 15 of lib/Bio/Roary/ParseGFFAnnotationRole.pm
# once (5µs+87µs) by Module::Runtime::require_module at line 16 of lib/Bio/Roary/ParseGFFAnnotationRole.pm
# once (5µs+86µs) by Module::Runtime::require_module at line 17 of lib/Bio/Roary/ParseGFFAnnotationRole.pm
# once (5µs+86µs) by Module::Runtime::require_module at line 15 of lib/Bio/Roary/ClustersRole.pm
# once (5µs+86µs) by Module::Runtime::require_module at line 15 of lib/Bio/Roary/JobRunner/Role.pm
# once (5µs+81µs) by Module::Runtime::require_module at line 16 of lib/Bio/Roary/JobRunner/Role.pm
# once (5µs+81µs) by Module::Runtime::require_module at line 16 of lib/Bio/Roary/ClustersRole.pm
# once (5µs+80µs) by Module::Runtime::require_module at line 17 of lib/Bio/Roary/JobRunner/Role.pm
# once (4µs+79µs) by Module::Runtime::require_module at line 18 of lib/Bio/Roary/JobRunner/Role.pm
# once (5µs+78µs) by Module::Runtime::require_module at line 19 of lib/Bio/Roary/JobRunner/Role.pm | ||||
| 41 | 13 | 3µs | my $meta = shift; | ||
| 42 | 13 | 2µs | my $name = shift; | ||
| 43 | 13 | 3µs | throw_exception( InvalidHasProvidedInARole => role_name => $meta->name, | ||
| 44 | attribute_name => $name, | ||||
| 45 | ) | ||||
| 46 | if @_ == 1; | ||||
| 47 | 13 | 27µs | 13 | 92µs | my %context = Moose::Util::_caller_info; # spent 92µs making 13 calls to Moose::Util::_caller_info, avg 7µs/call |
| 48 | 13 | 7µs | $context{context} = 'has declaration'; | ||
| 49 | 13 | 5µs | $context{type} = 'role'; | ||
| 50 | 13 | 23µs | my %options = ( definition_context => \%context, @_ ); | ||
| 51 | 13 | 10µs | my $attrs = ( ref($name) eq 'ARRAY' ) ? $name : [ ($name) ]; | ||
| 52 | 13 | 81µs | 13 | 968µs | $meta->add_attribute( $_, %options ) for @$attrs; # spent 968µs making 13 calls to Moose::Meta::Role::add_attribute, avg 74µs/call |
| 53 | } | ||||
| 54 | |||||
| 55 | sub _add_method_modifier { | ||||
| 56 | my $type = shift; | ||||
| 57 | my $meta = shift; | ||||
| 58 | |||||
| 59 | if ( ref($_[0]) eq 'Regexp' ) { | ||||
| 60 | throw_exception( RolesDoNotSupportRegexReferencesForMethodModifiers => modifier_type => $type, | ||||
| 61 | role_name => $meta->name, | ||||
| 62 | ); | ||||
| 63 | } | ||||
| 64 | |||||
| 65 | Moose::Util::add_method_modifier($meta, $type, \@_); | ||||
| 66 | } | ||||
| 67 | |||||
| 68 | sub before { _add_method_modifier('before', @_) } | ||||
| 69 | |||||
| 70 | sub after { _add_method_modifier('after', @_) } | ||||
| 71 | |||||
| 72 | sub around { _add_method_modifier('around', @_) } | ||||
| 73 | |||||
| 74 | # see Moose.pm for discussion | ||||
| 75 | sub super { | ||||
| 76 | return unless $Moose::SUPER_BODY; | ||||
| 77 | $Moose::SUPER_BODY->(@Moose::SUPER_ARGS); | ||||
| 78 | } | ||||
| 79 | |||||
| 80 | sub override { | ||||
| 81 | my $meta = shift; | ||||
| 82 | my ( $name, $code ) = @_; | ||||
| 83 | $meta->add_override_method_modifier( $name, $code ); | ||||
| 84 | } | ||||
| 85 | |||||
| 86 | sub inner { | ||||
| 87 | throw_exception("RolesDoNotSupportInner"); | ||||
| 88 | } | ||||
| 89 | |||||
| 90 | sub augment { | ||||
| 91 | throw_exception("RolesDoNotSupportAugment"); | ||||
| 92 | } | ||||
| 93 | |||||
| 94 | 1 | 7µs | 1 | 952µs | Moose::Exporter->setup_import_methods( # spent 952µs making 1 call to Moose::Exporter::setup_import_methods |
| 95 | with_meta => [ | ||||
| 96 | qw( with requires excludes has before after around override ) | ||||
| 97 | ], | ||||
| 98 | as_is => [ | ||||
| 99 | qw( extends super inner augment ), | ||||
| 100 | 'Carp::confess', | ||||
| 101 | 'Scalar::Util::blessed', | ||||
| 102 | ], | ||||
| 103 | ); | ||||
| 104 | |||||
| 105 | # spent 4.76ms (153µs+4.60) within Moose::Role::init_meta which was called 3 times, avg 1.59ms/call:
# 3 times (153µs+4.60ms) by Moose::Role::import at line 484 of Moose/Exporter.pm, avg 1.59ms/call | ||||
| 106 | 3 | 400ns | shift; | ||
| 107 | 3 | 8µs | my %args = @_; | ||
| 108 | |||||
| 109 | 3 | 2µs | my $role = $args{for_class}; | ||
| 110 | |||||
| 111 | 3 | 500ns | unless ($role) { | ||
| 112 | require Moose; | ||||
| 113 | throw_exception( InitMetaRequiresClass => params => \%args ); | ||||
| 114 | } | ||||
| 115 | |||||
| 116 | 3 | 1µs | my $metaclass = $args{metaclass} || "Moose::Meta::Role"; | ||
| 117 | 3 | 2µs | my $meta_name = exists $args{meta_name} ? $args{meta_name} : 'meta'; | ||
| 118 | |||||
| 119 | 3 | 20µs | 3 | 11µs | throw_exception( MetaclassNotLoaded => class_name => $metaclass ) # spent 11µs making 3 calls to Class::Load::XS::is_class_loaded, avg 4µs/call |
| 120 | unless is_class_loaded($metaclass); | ||||
| 121 | |||||
| 122 | 3 | 27µs | 3 | 5µs | throw_exception( MetaclassMustBeASubclassOfMooseMetaRole => role_name => $metaclass ) # spent 5µs making 3 calls to UNIVERSAL::isa, avg 2µs/call |
| 123 | unless $metaclass->isa('Moose::Meta::Role'); | ||||
| 124 | |||||
| 125 | # make a subtype for each Moose role | ||||
| 126 | 3 | 13µs | 6 | 2.20ms | role_type $role unless find_type_constraint($role); # spent 2.13ms making 3 calls to Moose::Util::TypeConstraints::role_type, avg 710µs/call
# spent 67µs making 3 calls to Moose::Util::TypeConstraints::find_type_constraint, avg 22µs/call |
| 127 | |||||
| 128 | 3 | 700ns | my $meta; | ||
| 129 | 3 | 7µs | 3 | 6µs | if ( $meta = Class::MOP::get_metaclass_by_name($role) ) { # spent 6µs making 3 calls to Class::MOP::get_metaclass_by_name, avg 2µs/call |
| 130 | unless ( $meta->isa("Moose::Meta::Role") ) { | ||||
| 131 | if ( $meta->isa('Moose::Meta::Class') ) { | ||||
| 132 | throw_exception( MetaclassIsAClassNotASubclassOfGivenMetaclass => class_name => $role, | ||||
| 133 | metaclass => $metaclass, | ||||
| 134 | ); | ||||
| 135 | } else { | ||||
| 136 | throw_exception( MetaclassIsNotASubclassOfGivenMetaclass => class_name => $role, | ||||
| 137 | metaclass => $metaclass, | ||||
| 138 | ); | ||||
| 139 | } | ||||
| 140 | } | ||||
| 141 | } | ||||
| 142 | else { | ||||
| 143 | 3 | 14µs | 3 | 523µs | $meta = $metaclass->initialize($role); # spent 523µs making 3 calls to Moose::Meta::Role::initialize, avg 174µs/call |
| 144 | 3 | 19µs | 6 | 82µs | my $filename = module_notional_filename($meta->name); # spent 79µs making 3 calls to Module::Runtime::module_notional_filename, avg 26µs/call
# spent 3µs making 3 calls to Class::MOP::Package::name, avg 1µs/call |
| 145 | 3 | 2µs | $INC{$filename} = '(set by Moose)' | ||
| 146 | unless exists $INC{$filename}; | ||||
| 147 | } | ||||
| 148 | |||||
| 149 | 3 | 3µs | if (defined $meta_name) { | ||
| 150 | # also check for inherited non moose 'meta' method? | ||||
| 151 | 3 | 11µs | 3 | 179µs | my $existing = $meta->get_method($meta_name); # spent 179µs making 3 calls to Class::MOP::Mixin::HasMethods::get_method, avg 60µs/call |
| 152 | 3 | 500ns | if ($existing && !$existing->isa('Class::MOP::Method::Meta')) { | ||
| 153 | Carp::cluck "Moose::Role is overwriting an existing method named " | ||||
| 154 | . "$meta_name in role $role with a method " | ||||
| 155 | . "which returns the class's metaclass. If this is " | ||||
| 156 | . "actually what you want, you should remove the " | ||||
| 157 | . "existing method, otherwise, you should rename or " | ||||
| 158 | . "disable this generated method using the " | ||||
| 159 | . "'-meta_name' option to 'use Moose::Role'."; | ||||
| 160 | } | ||||
| 161 | 3 | 10µs | 3 | 1.60ms | $meta->_add_meta_method($meta_name); # spent 1.60ms making 3 calls to Class::MOP::Mixin::HasMethods::_add_meta_method, avg 534µs/call |
| 162 | } | ||||
| 163 | |||||
| 164 | 3 | 11µs | return $meta; | ||
| 165 | } | ||||
| 166 | |||||
| 167 | 1 | 8µs | 1; | ||
| 168 | |||||
| 169 | # ABSTRACT: The Moose Role | ||||
| 170 | |||||
| 171 | __END__ |