| Filename | /home/hinrik/perl5/perlbrew/perls/perl-5.13.5/lib/site_perl/5.13.5/x86_64-linux/Mouse/Role.pm |
| Statements | Executed 135 statements in 1.15ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 8 | 8 | 4 | 176µs | 308µs | Mouse::Role::has |
| 11 | 11 | 3 | 149µs | 635µs | Mouse::Role::requires |
| 4 | 1 | 1 | 142µs | 539µs | Mouse::Role::init_meta |
| 1 | 1 | 1 | 30µs | 41µs | Mouse::Role::BEGIN@2 |
| 1 | 1 | 1 | 16µs | 71µs | Mouse::Role::BEGIN@6 |
| 1 | 1 | 1 | 14µs | 55µs | Mouse::Role::BEGIN@7 |
| 1 | 1 | 1 | 6µs | 6µs | Mouse::Role::BEGIN@9 |
| 0 | 0 | 0 | 0s | 0s | Hailo::Role::Arguments::meta |
| 0 | 0 | 0 | 0s | 0s | Hailo::Role::Engine::meta |
| 0 | 0 | 0 | 0s | 0s | Hailo::Role::Storage::meta |
| 0 | 0 | 0 | 0s | 0s | Hailo::Role::Tokenizer::meta |
| 0 | 0 | 0 | 0s | 0s | Mouse::Role::__ANON__[:121] |
| 0 | 0 | 0 | 0s | 0s | Mouse::Role::after |
| 0 | 0 | 0 | 0s | 0s | Mouse::Role::around |
| 0 | 0 | 0 | 0s | 0s | Mouse::Role::augment |
| 0 | 0 | 0 | 0s | 0s | Mouse::Role::before |
| 0 | 0 | 0 | 0s | 0s | Mouse::Role::excludes |
| 0 | 0 | 0 | 0s | 0s | Mouse::Role::extends |
| 0 | 0 | 0 | 0s | 0s | Mouse::Role::inner |
| 0 | 0 | 0 | 0s | 0s | Mouse::Role::override |
| 0 | 0 | 0 | 0s | 0s | Mouse::Role::super |
| 0 | 0 | 0 | 0s | 0s | Mouse::Role::with |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package Mouse::Role; | ||||
| 2 | 2 | 42µs | 2 | 53µs | # spent 41µs (30+11) within Mouse::Role::BEGIN@2 which was called:
# once (30µs+11µs) by Any::Moose::_install_module at line 2 # spent 41µs making 1 call to Mouse::Role::BEGIN@2
# spent 11µs making 1 call to Mouse::Exporter::import |
| 3 | |||||
| 4 | 1 | 1µs | our $VERSION = '0.80'; | ||
| 5 | |||||
| 6 | 2 | 31µs | 2 | 125µs | # spent 71µs (16+55) within Mouse::Role::BEGIN@6 which was called:
# once (16µs+55µs) by Any::Moose::_install_module at line 6 # spent 71µs making 1 call to Mouse::Role::BEGIN@6
# spent 55µs making 1 call to Exporter::import |
| 7 | 2 | 28µs | 2 | 97µs | # spent 55µs (14+41) within Mouse::Role::BEGIN@7 which was called:
# once (14µs+41µs) by Any::Moose::_install_module at line 7 # spent 55µs making 1 call to Mouse::Role::BEGIN@7
# spent 42µs making 1 call to Exporter::import |
| 8 | |||||
| 9 | 2 | 536µs | 1 | 6µs | # spent 6µs within Mouse::Role::BEGIN@9 which was called:
# once (6µs+0s) by Any::Moose::_install_module at line 9 # spent 6µs making 1 call to Mouse::Role::BEGIN@9 |
| 10 | |||||
| 11 | 1 | 8µs | 1 | 283µs | Mouse::Exporter->setup_import_methods( # spent 283µs making 1 call to Mouse::Exporter::setup_import_methods |
| 12 | as_is => [qw( | ||||
| 13 | extends with | ||||
| 14 | has | ||||
| 15 | before after around | ||||
| 16 | override super | ||||
| 17 | augment inner | ||||
| 18 | |||||
| 19 | requires excludes | ||||
| 20 | ), | ||||
| 21 | \&Scalar::Util::blessed, | ||||
| 22 | \&Carp::confess, | ||||
| 23 | ], | ||||
| 24 | ); | ||||
| 25 | |||||
| 26 | |||||
| 27 | sub extends { | ||||
| 28 | Carp::croak "Roles do not support 'extends'"; | ||||
| 29 | } | ||||
| 30 | |||||
| 31 | sub with { | ||||
| 32 | Mouse::Util::apply_all_roles(scalar(caller), @_); | ||||
| 33 | return; | ||||
| 34 | } | ||||
| 35 | |||||
| 36 | # spent 308µs (176+132) within Mouse::Role::has which was called 8 times, avg 39µs/call:
# once (31µs+28µs) by Mouse::Util::_try_load_one_class at line 22 of Hailo/Role/Tokenizer.pm
# once (26µs+20µs) by Mouse::Util::_try_load_one_class at line 13 of Hailo/Role/Storage.pm
# once (24µs+17µs) by Mouse::Util::_try_load_one_class at line 13 of Hailo/Role/Arguments.pm
# once (24µs+16µs) by Mouse::Util::_try_load_one_class at line 13 of Hailo/Role/Engine.pm
# once (18µs+14µs) by Mouse::Util::_try_load_one_class at line 23 of Hailo/Role/Storage.pm
# once (18µs+13µs) by Mouse::Util::_try_load_one_class at line 19 of Hailo/Role/Engine.pm
# once (18µs+12µs) by Mouse::Util::_try_load_one_class at line 18 of Hailo/Role/Storage.pm
# once (17µs+12µs) by Mouse::Util::_try_load_one_class at line 29 of Hailo/Role/Storage.pm | ||||
| 37 | 48 | 170µs | 8 | 51µs | my $meta = Mouse::Meta::Role->initialize(scalar caller); # spent 51µs making 8 calls to Mouse::Meta::Module::initialize, avg 6µs/call |
| 38 | my $name = shift; | ||||
| 39 | |||||
| 40 | $meta->throw_error(q{Usage: has 'name' => ( key => value, ... )}) | ||||
| 41 | if @_ % 2; # odd number of arguments | ||||
| 42 | |||||
| 43 | for my $n(ref($name) ? @{$name} : $name){ | ||||
| 44 | 8 | 81µs | $meta->add_attribute($n => @_); # spent 81µs making 8 calls to Mouse::Meta::Role::add_attribute, avg 10µs/call | ||
| 45 | } | ||||
| 46 | return; | ||||
| 47 | } | ||||
| 48 | |||||
| 49 | sub before { | ||||
| 50 | my $meta = Mouse::Meta::Role->initialize(scalar caller); | ||||
| 51 | my $code = pop; | ||||
| 52 | for my $name($meta->_collect_methods(@_)) { | ||||
| 53 | $meta->add_before_method_modifier($name => $code); | ||||
| 54 | } | ||||
| 55 | return; | ||||
| 56 | } | ||||
| 57 | |||||
| 58 | sub after { | ||||
| 59 | my $meta = Mouse::Meta::Role->initialize(scalar caller); | ||||
| 60 | my $code = pop; | ||||
| 61 | for my $name($meta->_collect_methods(@_)) { | ||||
| 62 | $meta->add_after_method_modifier($name => $code); | ||||
| 63 | } | ||||
| 64 | return; | ||||
| 65 | } | ||||
| 66 | |||||
| 67 | sub around { | ||||
| 68 | my $meta = Mouse::Meta::Role->initialize(scalar caller); | ||||
| 69 | my $code = pop; | ||||
| 70 | for my $name($meta->_collect_methods(@_)) { | ||||
| 71 | $meta->add_around_method_modifier($name => $code); | ||||
| 72 | } | ||||
| 73 | return; | ||||
| 74 | } | ||||
| 75 | |||||
| 76 | |||||
| 77 | sub super { | ||||
| 78 | return if !defined $Mouse::SUPER_BODY; | ||||
| 79 | $Mouse::SUPER_BODY->(@Mouse::SUPER_ARGS); | ||||
| 80 | } | ||||
| 81 | |||||
| 82 | sub override { | ||||
| 83 | # my($name, $code) = @_; | ||||
| 84 | Mouse::Meta::Role->initialize(scalar caller)->add_override_method_modifier(@_); | ||||
| 85 | return; | ||||
| 86 | } | ||||
| 87 | |||||
| 88 | # We keep the same errors messages as Moose::Role emits, here. | ||||
| 89 | sub inner { | ||||
| 90 | Carp::croak "Roles cannot support 'inner'"; | ||||
| 91 | } | ||||
| 92 | |||||
| 93 | sub augment { | ||||
| 94 | Carp::croak "Roles cannot support 'augment'"; | ||||
| 95 | } | ||||
| 96 | |||||
| 97 | # spent 635µs (149+486) within Mouse::Role::requires which was called 11 times, avg 58µs/call:
# once (17µs+63µs) by Mouse::Util::_try_load_one_class at line 34 of Hailo/Role/Storage.pm
# once (15µs+51µs) by Mouse::Util::_try_load_one_class at line 40 of Hailo/Role/Tokenizer.pm
# once (15µs+46µs) by Mouse::Util::_try_load_one_class at line 26 of Hailo/Role/Engine.pm
# once (13µs+49µs) by Mouse::Util::_try_load_one_class at line 36 of Hailo/Role/Storage.pm
# once (12µs+42µs) by Mouse::Util::_try_load_one_class at line 38 of Hailo/Role/Storage.pm
# once (13µs+41µs) by Mouse::Util::_try_load_one_class at line 39 of Hailo/Role/Storage.pm
# once (13µs+40µs) by Mouse::Util::_try_load_one_class at line 40 of Hailo/Role/Storage.pm
# once (13µs+40µs) by Mouse::Util::_try_load_one_class at line 41 of Hailo/Role/Tokenizer.pm
# once (13µs+40µs) by Mouse::Util::_try_load_one_class at line 35 of Hailo/Role/Storage.pm
# once (12µs+38µs) by Mouse::Util::_try_load_one_class at line 37 of Hailo/Role/Storage.pm
# once (12µs+37µs) by Mouse::Util::_try_load_one_class at line 27 of Hailo/Role/Engine.pm | ||||
| 98 | 44 | 144µs | 11 | 61µs | my $meta = Mouse::Meta::Role->initialize(scalar caller); # spent 61µs making 11 calls to Mouse::Meta::Module::initialize, avg 6µs/call |
| 99 | $meta->throw_error("Must specify at least one method") unless @_; | ||||
| 100 | 11 | 426µs | $meta->add_required_methods(@_); # spent 426µs making 11 calls to Mouse::Meta::Role::add_required_methods, avg 39µs/call | ||
| 101 | return; | ||||
| 102 | } | ||||
| 103 | |||||
| 104 | sub excludes { | ||||
| 105 | Mouse::Util::not_supported(); | ||||
| 106 | } | ||||
| 107 | |||||
| 108 | # spent 539µs (142+397) within Mouse::Role::init_meta which was called 4 times, avg 135µs/call:
# 4 times (142µs+397µs) by Mouse::Exporter::do_import at line 181 of Mouse/Exporter.pm, avg 135µs/call | ||||
| 109 | 32 | 186µs | shift; | ||
| 110 | my %args = @_; | ||||
| 111 | |||||
| 112 | my $class = $args{for_class} | ||||
| 113 | or Carp::confess("Cannot call init_meta without specifying a for_class"); | ||||
| 114 | |||||
| 115 | my $metaclass = $args{metaclass} || 'Mouse::Meta::Role'; | ||||
| 116 | |||||
| 117 | 4 | 131µs | my $meta = $metaclass->initialize($class); # spent 131µs making 4 calls to Mouse::Meta::Module::initialize, avg 33µs/call | ||
| 118 | |||||
| 119 | $meta->add_method(meta => sub{ | ||||
| 120 | $metaclass->initialize(ref($_[0]) || $_[0]); | ||||
| 121 | 4 | 41µs | }); # spent 41µs making 4 calls to Mouse::Meta::Module::add_method, avg 10µs/call | ||
| 122 | |||||
| 123 | # make a role type for each Mouse role | ||||
| 124 | 8 | 226µs | Mouse::Util::TypeConstraints::role_type($class) # spent 146µs making 1 call to Mouse::Util::TypeConstraints::role_type
# spent 74µs making 4 calls to Mouse::Util::TypeConstraints::find_type_constraint, avg 18µs/call
# spent 7µs making 3 calls to Mouse::Meta::TypeConstraint::_identity, avg 2µs/call | ||
| 125 | unless Mouse::Util::TypeConstraints::find_type_constraint($class); | ||||
| 126 | |||||
| 127 | return $meta; | ||||
| 128 | } | ||||
| 129 | |||||
| 130 | 1 | 6µs | 1; | ||
| 131 | |||||
| 132 | __END__ |