| Filename | /2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/namespace/autoclean.pm |
| Statements | Executed 43 statements in 1.07ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 1.27ms | 1.86ms | namespace::autoclean::BEGIN@16 |
| 1 | 1 | 1 | 316µs | 2.10ms | namespace::autoclean::BEGIN@14 |
| 1 | 1 | 1 | 242µs | 2.12ms | namespace::autoclean::__ANON__[:57] |
| 1 | 1 | 1 | 56µs | 107µs | namespace::autoclean::import |
| 1 | 1 | 1 | 15µs | 36µs | namespace::autoclean::BEGIN@13 |
| 1 | 1 | 1 | 13µs | 43µs | namespace::autoclean::BEGIN@15 |
| 1 | 1 | 1 | 13µs | 16µs | MooseX::Traits::BEGIN@1 |
| 1 | 1 | 1 | 7µs | 14µs | MooseX::Traits::BEGIN@2.6 |
| 1 | 1 | 1 | 3µs | 3µs | namespace::autoclean::BEGIN@5 |
| 0 | 0 | 0 | 0s | 0s | namespace::autoclean::__ANON__[:25] |
| 0 | 0 | 0 | 0s | 0s | namespace::autoclean::__ANON__[:26] |
| 0 | 0 | 0 | 0s | 0s | namespace::autoclean::__ANON__[:27] |
| 0 | 0 | 0 | 0s | 0s | namespace::autoclean::__ANON__[:33] |
| 0 | 0 | 0 | 0s | 0s | namespace::autoclean::__ANON__[:51] |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | 3 | 17µs | 2 | 19µs | # spent 16µs (13+3) within MooseX::Traits::BEGIN@1 which was called:
# once (13µs+3µs) by MooseX::Traits::BEGIN@9 at line 1 # spent 16µs making 1 call to MooseX::Traits::BEGIN@1
# spent 3µs making 1 call to strict::import |
| 2 | 3 | 34µs | 2 | 21µs | # spent 14µs (7+7) within MooseX::Traits::BEGIN@2.6 which was called:
# once (7µs+7µs) by MooseX::Traits::BEGIN@9 at line 2 # spent 14µs making 1 call to MooseX::Traits::BEGIN@2.6
# spent 7µs making 1 call to warnings::import |
| 3 | |||||
| 4 | package namespace::autoclean; | ||||
| 5 | # spent 3µs within namespace::autoclean::BEGIN@5 which was called:
# once (3µs+0s) by MooseX::Traits::BEGIN@9 at line 7 | ||||
| 6 | 1 | 6µs | $namespace::autoclean::AUTHORITY = 'cpan:FLORA'; | ||
| 7 | 1 | 75µs | 1 | 3µs | } # spent 3µs making 1 call to namespace::autoclean::BEGIN@5 |
| 8 | { | ||||
| 9 | 2 | 3µs | $namespace::autoclean::VERSION = '0.13'; | ||
| 10 | } | ||||
| 11 | # ABSTRACT: Keep imports out of your namespace | ||||
| 12 | |||||
| 13 | 3 | 48µs | 2 | 57µs | # spent 36µs (15+21) within namespace::autoclean::BEGIN@13 which was called:
# once (15µs+21µs) by MooseX::Traits::BEGIN@9 at line 13 # spent 36µs making 1 call to namespace::autoclean::BEGIN@13
# spent 21µs making 1 call to UNIVERSAL::VERSION |
| 14 | 3 | 84µs | 2 | 2.27ms | # spent 2.10ms (316µs+1.78) within namespace::autoclean::BEGIN@14 which was called:
# once (316µs+1.78ms) by MooseX::Traits::BEGIN@9 at line 14 # spent 2.10ms making 1 call to namespace::autoclean::BEGIN@14
# spent 175µs making 1 call to Sub::Exporter::__ANON__[Sub/Exporter.pm:756] |
| 15 | 3 | 27µs | 2 | 72µs | # spent 43µs (13+30) within namespace::autoclean::BEGIN@15 which was called:
# once (13µs+30µs) by MooseX::Traits::BEGIN@9 at line 15 # spent 43µs making 1 call to namespace::autoclean::BEGIN@15
# spent 30µs making 1 call to Exporter::import |
| 16 | 3 | 424µs | 3 | 2.07ms | # spent 1.86ms (1.27+594µs) within namespace::autoclean::BEGIN@16 which was called:
# once (1.27ms+594µs) by MooseX::Traits::BEGIN@9 at line 16 # spent 1.86ms making 1 call to namespace::autoclean::BEGIN@16
# spent 188µs making 1 call to namespace::clean::import
# spent 20µs making 1 call to UNIVERSAL::VERSION |
| 17 | |||||
| 18 | |||||
| 19 | # spent 107µs (56+52) within namespace::autoclean::import which was called:
# once (56µs+52µs) by MooseX::Traits::BEGIN@9 at line 9 of MooseX/Traits.pm | ||||
| 20 | 6 | 58µs | my ($class, %args) = @_; | ||
| 21 | |||||
| 22 | my $subcast = sub { | ||||
| 23 | my $i = shift; | ||||
| 24 | return $i if ref $i eq 'CODE'; | ||||
| 25 | return sub { $_ =~ $i } if ref $i eq 'Regexp'; | ||||
| 26 | return sub { $_ eq $i }; | ||||
| 27 | }; | ||||
| 28 | |||||
| 29 | my $runtest = sub { | ||||
| 30 | my ($code, $method_name) = @_; | ||||
| 31 | local $_ = $method_name; | ||||
| 32 | return $code->(); | ||||
| 33 | }; | ||||
| 34 | |||||
| 35 | my $cleanee = exists $args{-cleanee} ? $args{-cleanee} : scalar caller; | ||||
| 36 | |||||
| 37 | my @also = map { $subcast->($_) } ( | ||||
| 38 | exists $args{-also} | ||||
| 39 | ? (ref $args{-also} eq 'ARRAY' ? @{ $args{-also} } : $args{-also}) | ||||
| 40 | : () | ||||
| 41 | ); | ||||
| 42 | |||||
| 43 | # spent 2.12ms (242µs+1.88) within namespace::autoclean::__ANON__[/2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/namespace/autoclean.pm:57] which was called:
# once (242µs+1.88ms) by B::Hooks::EndOfScope::__ANON__[/2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/B/Hooks/EndOfScope.pm:26] at line 26 of B/Hooks/EndOfScope.pm | ||||
| 44 | 7 | 179µs | 1 | 36µs | my $meta = Class::MOP::Class->initialize($cleanee); # spent 36µs making 1 call to Class::MOP::Class::initialize |
| 45 | 1 | 1.47ms | my %methods = map { ($_ => 1) } $meta->get_method_list; # spent 1.47ms making 1 call to Class::MOP::Mixin::HasMethods::get_method_list | ||
| 46 | 2 | 18µs | $methods{meta} = 1 if $meta->isa('Moose::Meta::Role') && Moose->VERSION < 0.90; # spent 14µs making 1 call to UNIVERSAL::VERSION
# spent 4µs making 1 call to UNIVERSAL::isa | ||
| 47 | my %extra = (); | ||||
| 48 | |||||
| 49 | for my $method (keys %methods) { | ||||
| 50 | 8 | 72µs | next if exists $extra{$_}; | ||
| 51 | 4 | 9µs | next unless first { $runtest->($_, $method) } @also; # spent 9µs making 4 calls to List::Util::first, avg 2µs/call | ||
| 52 | $extra{ $method } = 1; | ||||
| 53 | } | ||||
| 54 | |||||
| 55 | 1 | 50µs | my @symbols = keys %{ $meta->get_all_package_symbols('CODE') }; # spent 50µs making 1 call to Class::MOP::Package::get_all_package_symbols | ||
| 56 | 1 | 296µs | namespace::clean->clean_subroutines($cleanee, keys %extra, grep { !$methods{$_} } @symbols); # spent 296µs making 1 call to namespace::clean::clean_subroutines | ||
| 57 | 1 | 52µs | }; # spent 52µs making 1 call to B::Hooks::EndOfScope::on_scope_end | ||
| 58 | } | ||||
| 59 | |||||
| 60 | 1 | 8µs | 1; | ||
| 61 | |||||
| 62 | 1 | 32µs | 1 | 38.4ms | __END__ # spent 38.4ms making 1 call to B::Hooks::EndOfScope::__ANON__[B/Hooks/EndOfScope.pm:26] |