| Filename | /2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/MooseX/Traits.pm |
| Statements | Executed 34 statements in 1.43ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 606µs | 43.2ms | MooseX::Traits::BEGIN@9 |
| 1 | 1 | 1 | 479µs | 971µs | MooseX::Traits::BEGIN@4 |
| 1 | 1 | 1 | 64µs | 14.3ms | MooseX::Traits::new_with_traits |
| 1 | 1 | 1 | 27µs | 344µs | MooseX::Traits::BEGIN@86 |
| 1 | 1 | 1 | 19µs | 3.05ms | MooseX::Traits::BEGIN@2 |
| 1 | 1 | 1 | 17µs | 11.0ms | MooseX::Traits::with_traits |
| 1 | 1 | 1 | 9µs | 74µs | MooseX::Traits::BEGIN@7 |
| 1 | 1 | 1 | 6µs | 19µs | MooseX::Traits::BEGIN@6 |
| 0 | 0 | 0 | 0s | 0s | MooseX::Traits::apply_traits |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package MooseX::Traits; | ||||
| 2 | 3 | 61µs | 2 | 6.09ms | # spent 3.05ms (19µs+3.03) within MooseX::Traits::BEGIN@2 which was called:
# once (19µs+3.03ms) by Module::Runtime::require_module at line 2 # spent 3.05ms making 1 call to MooseX::Traits::BEGIN@2
# spent 3.03ms making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:492] |
| 3 | |||||
| 4 | 3 | 126µs | 2 | 1.10ms | # spent 971µs (479+492) within MooseX::Traits::BEGIN@4 which was called:
# once (479µs+492µs) by Module::Runtime::require_module at line 4 # spent 971µs making 1 call to MooseX::Traits::BEGIN@4
# spent 133µs making 1 call to Sub::Exporter::__ANON__[Sub/Exporter.pm:756] |
| 5 | |||||
| 6 | 3 | 18µs | 2 | 31µs | # spent 19µs (6+12) within MooseX::Traits::BEGIN@6 which was called:
# once (6µs+12µs) by Module::Runtime::require_module at line 6 # spent 19µs making 1 call to MooseX::Traits::BEGIN@6
# spent 12µs making 1 call to warnings::import |
| 7 | 3 | 21µs | 2 | 140µs | # spent 74µs (9+65) within MooseX::Traits::BEGIN@7 which was called:
# once (9µs+65µs) by Module::Runtime::require_module at line 7 # spent 74µs making 1 call to MooseX::Traits::BEGIN@7
# spent 66µs making 1 call to warnings::register::import |
| 8 | |||||
| 9 | 3 | 1.01ms | 2 | 43.3ms | # spent 43.2ms (606µs+42.6) within MooseX::Traits::BEGIN@9 which was called:
# once (606µs+42.6ms) by Module::Runtime::require_module at line 9 # spent 43.2ms making 1 call to MooseX::Traits::BEGIN@9
# spent 107µs making 1 call to namespace::autoclean::import |
| 10 | |||||
| 11 | 1 | 2µs | our $VERSION = '0.11'; | ||
| 12 | 1 | 900ns | our $AUTHORITY = 'id:JROCKWAY'; | ||
| 13 | |||||
| 14 | 1 | 5µs | 1 | 492µs | has '_trait_namespace' => ( # spent 492µs making 1 call to Moose::Role::has |
| 15 | # no accessors or init_arg | ||||
| 16 | init_arg => undef, | ||||
| 17 | isa => 'Str', | ||||
| 18 | is => 'bare', | ||||
| 19 | ); | ||||
| 20 | |||||
| 21 | # spent 11.0ms (17µs+10.9) within MooseX::Traits::with_traits which was called:
# once (17µs+10.9ms) by MooseX::Traits::new_with_traits at line 46 | ||||
| 22 | 3 | 19µs | my ($class, @traits) = @_; | ||
| 23 | |||||
| 24 | 1 | 10.9ms | my $new_class = new_class_with_traits( # spent 10.9ms making 1 call to MooseX::Traits::Util::new_class_with_traits | ||
| 25 | $class, | ||||
| 26 | @traits, | ||||
| 27 | ); | ||||
| 28 | |||||
| 29 | 1 | 800ns | return $new_class->name; # spent 800ns making 1 call to Class::MOP::Package::name | ||
| 30 | } | ||||
| 31 | |||||
| 32 | # somewhat deprecated, but use if you want to | ||||
| 33 | # spent 14.3ms (64µs+14.3) within MooseX::Traits::new_with_traits which was called:
# once (64µs+14.3ms) by main::RUNTIME at line 45 of xt/tapper-mcp-scheduler-with-db-longrun.t | ||||
| 34 | 9 | 49µs | my $class = shift; | ||
| 35 | |||||
| 36 | my ($hashref, %args) = 0; | ||||
| 37 | if (ref($_[0]) eq 'HASH') { | ||||
| 38 | %args = %{ +shift }; | ||||
| 39 | $hashref = 1; | ||||
| 40 | } else { | ||||
| 41 | %args = @_; | ||||
| 42 | } | ||||
| 43 | |||||
| 44 | my $traits = delete $args{traits} || []; | ||||
| 45 | |||||
| 46 | 1 | 11.0ms | my $new_class = $class->with_traits(ref $traits ? @$traits : $traits ); # spent 11.0ms making 1 call to MooseX::Traits::with_traits | ||
| 47 | |||||
| 48 | 2 | 18µs | my $constructor = $new_class->meta->constructor_name; # spent 17µs making 1 call to MooseX::Traits::__ANON__::SERIAL::1::meta
# spent 1µs making 1 call to Class::MOP::Class::constructor_name | ||
| 49 | confess "$class ($new_class) does not have a constructor defined via the MOP?" | ||||
| 50 | if !$constructor; | ||||
| 51 | |||||
| 52 | 1 | 3.29ms | return $new_class->$constructor($hashref ? \%args : %args); # spent 3.29ms making 1 call to Moose::Object::new | ||
| 53 | |||||
| 54 | } | ||||
| 55 | |||||
| 56 | # this code is broken and should never have been added. i probably | ||||
| 57 | # won't delete it, but it is definitely not up-to-date with respect to | ||||
| 58 | # other features, and never will be. | ||||
| 59 | # | ||||
| 60 | # runtime role application is fundamentally broken. if you really | ||||
| 61 | # need it, write it yourself, but consider applying the roles before | ||||
| 62 | # you create an instance. | ||||
| 63 | |||||
| 64 | sub apply_traits { | ||||
| 65 | my ($self, $traits, $rebless_params) = @_; | ||||
| 66 | |||||
| 67 | # disable this warning with "use MooseX::Traits; no warnings 'MooseX::Traits'" | ||||
| 68 | warnings::warnif('apply_traits is deprecated due to being fundamentally broken. '. | ||||
| 69 | q{disable this warning with "no warnings 'MooseX::Traits'"}); | ||||
| 70 | |||||
| 71 | # arrayify | ||||
| 72 | my @traits = $traits; | ||||
| 73 | @traits = @$traits if ref $traits; | ||||
| 74 | |||||
| 75 | if (@traits) { | ||||
| 76 | @traits = MooseX::Traits::Util::resolve_traits( | ||||
| 77 | $self, @traits, | ||||
| 78 | ); | ||||
| 79 | |||||
| 80 | for my $trait (@traits){ | ||||
| 81 | $trait->meta->apply($self, rebless_params => $rebless_params || {}); | ||||
| 82 | } | ||||
| 83 | } | ||||
| 84 | } | ||||
| 85 | |||||
| 86 | 3 | 58µs | 2 | 662µs | # spent 344µs (27+318) within MooseX::Traits::BEGIN@86 which was called:
# once (27µs+318µs) by Module::Runtime::require_module at line 86 # spent 344µs making 1 call to MooseX::Traits::BEGIN@86
# spent 318µs making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:678] |
| 87 | |||||
| 88 | 1 | 24µs | 1; | ||
| 89 | |||||
| 90 | 1 | 36µs | 1 | 2.14ms | __END__ # spent 2.14ms making 1 call to B::Hooks::EndOfScope::__ANON__[B/Hooks/EndOfScope.pm:26] |