| Filename | /Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Sub/Exporter/Progressive.pm | 
| Statements | Executed 85 statements in 825µs | 
| Calls | P | F | Exclusive Time | Inclusive Time | Subroutine | 
|---|---|---|---|---|---|
| 2 | 2 | 2 | 75µs | 141µs | Sub::Exporter::Progressive::import | 
| 2 | 1 | 1 | 60µs | 66µs | Sub::Exporter::Progressive::sub_export_options | 
| 1 | 1 | 1 | 29µs | 32µs | Sub::Exporter::Progressive::BEGIN@3 | 
| 1 | 1 | 1 | 29µs | 38µs | Sub::Exporter::Progressive::__ANON__[:47] | 
| 8 | 4 | 1 | 14µs | 14µs | Sub::Exporter::Progressive::CORE:match (opcode) | 
| 1 | 1 | 1 | 7µs | 13µs | Sub::Exporter::Progressive::BEGIN@20 | 
| 1 | 1 | 1 | 5µs | 6µs | Sub::Exporter::Progressive::BEGIN@26 | 
| 1 | 1 | 1 | 5µs | 44µs | Sub::Exporter::Progressive::BEGIN@4 | 
| 1 | 1 | 1 | 4µs | 17µs | Sub::Exporter::Progressive::BEGIN@21 | 
| 1 | 1 | 1 | 1µs | 1µs | Sub::Exporter::Progressive::CORE:subst (opcode) | 
| 0 | 0 | 0 | 0s | 0s | Sub::Exporter::Progressive::_croak | 
| Line | State ments | Time on line | Calls | Time in subs | Code | 
|---|---|---|---|---|---|
| 1 | package Sub::Exporter::Progressive; | ||||
| 2 | 1 | 0s | $Sub::Exporter::Progressive::VERSION = '0.001013'; | ||
| 3 | 2 | 28µs | 2 | 35µs | # spent 32µs (29+3) within Sub::Exporter::Progressive::BEGIN@3 which was called:
#    once (29µs+3µs) by B::Hooks::EndOfScope::XS::BEGIN@19 at line 3 # spent    32µs making 1 call to Sub::Exporter::Progressive::BEGIN@3
# spent     3µs making 1 call to strict::import | 
| 4 | 2 | 82µs | 2 | 83µs | # spent 44µs (5+39) within Sub::Exporter::Progressive::BEGIN@4 which was called:
#    once (5µs+39µs) by B::Hooks::EndOfScope::XS::BEGIN@19 at line 4 # spent    44µs making 1 call to Sub::Exporter::Progressive::BEGIN@4
# spent    39µs making 1 call to warnings::import | 
| 5 | |||||
| 6 | # ABSTRACT: Only use Sub::Exporter if you need it | ||||
| 7 | |||||
| 8 | sub _croak { | ||||
| 9 | require Carp; | ||||
| 10 | &Carp::croak; | ||||
| 11 | } | ||||
| 12 | |||||
| 13 | # spent 141µs (75+66) within Sub::Exporter::Progressive::import which was called 2 times, avg 70µs/call:
#    once (54µs+43µs) by B::Hooks::EndOfScope::BEGIN@20 at line 23 of B/Hooks/EndOfScope.pm
#    once (21µs+23µs) by B::Hooks::EndOfScope::XS::BEGIN@19 at line 22 of B/Hooks/EndOfScope/XS.pm | ||||
| 14 | 2 | 1µs | my ($self, @args) = @_; | ||
| 15 | |||||
| 16 | 2 | 1µs | my $inner_target = caller; | ||
| 17 | 2 | 3µs | 2 | 66µs | my $export_data = sub_export_options($inner_target, @args);    # spent    66µs making 2 calls to Sub::Exporter::Progressive::sub_export_options, avg 33µs/call | 
| 18 | |||||
| 19 | 2 | 0s | my $full_exporter; | ||
| 20 | 2 | 24µs | 2 | 19µs | # spent 13µs (7+6) within Sub::Exporter::Progressive::BEGIN@20 which was called:
#    once (7µs+6µs) by B::Hooks::EndOfScope::XS::BEGIN@19 at line 20    # spent    13µs making 1 call to Sub::Exporter::Progressive::BEGIN@20
   # spent     6µs making 1 call to strict::unimport | 
| 21 | 2 | 45µs | 2 | 30µs | # spent 17µs (4+13) within Sub::Exporter::Progressive::BEGIN@21 which was called:
#    once (4µs+13µs) by B::Hooks::EndOfScope::XS::BEGIN@19 at line 21    # spent    17µs making 1 call to Sub::Exporter::Progressive::BEGIN@21
   # spent    13µs making 1 call to warnings::unimport | 
| 22 | 2 | 10µs | @{"${inner_target}::EXPORT_OK"} = @{$export_data->{exports}}; | ||
| 23 | 2 | 9µs | @{"${inner_target}::EXPORT"} = @{$export_data->{defaults}}; | ||
| 24 | 2 | 8µs | %{"${inner_target}::EXPORT_TAGS"} = %{$export_data->{tags}}; | ||
| 25 | # spent 38µs (29+9) within Sub::Exporter::Progressive::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Sub/Exporter/Progressive.pm:47] which was called:
#    once (29µs+9µs) by namespace::clean::BEGIN@11 at line 11 of namespace/clean.pm | ||||
| 26 | 2 | 455µs | 2 | 7µs | # spent 6µs (5+1000ns) within Sub::Exporter::Progressive::BEGIN@26 which was called:
#    once (5µs+1000ns) by B::Hooks::EndOfScope::XS::BEGIN@19 at line 26       # spent     6µs making 1 call to Sub::Exporter::Progressive::BEGIN@26
      # spent     1µs making 1 call to strict::import | 
| 27 | 1 | 1µs | my ($self, @args) = @_; | ||
| 28 | |||||
| 29 | 1 | 3µs | if ( grep { | ||
| 30 | 1 | 13µs | 1 | 7µs | length ref $_          # spent     7µs making 1 call to Sub::Exporter::Progressive::CORE:match | 
| 31 | or | ||||
| 32 | $_ !~ / \A [:-]? \w+ \z /xm | ||||
| 33 | } @args ) { | ||||
| 34 | _croak 'your usage of Sub::Exporter::Progressive requires Sub::Exporter to be installed' | ||||
| 35 | unless eval { require Sub::Exporter }; | ||||
| 36 | $full_exporter ||= Sub::Exporter::build_exporter($export_data->{original}); | ||||
| 37 | |||||
| 38 | goto $full_exporter; | ||||
| 39 | 1 | 4µs | 1 | 1µs | } elsif ( defined( (my ($num) = grep { m/^\d/ } @args)[0] ) ) {       # spent     1µs making 1 call to Sub::Exporter::Progressive::CORE:match | 
| 40 | _croak "cannot export symbols with a leading digit: '$num'"; | ||||
| 41 | } else { | ||||
| 42 | 1 | 1µs | require Exporter; | ||
| 43 | 1 | 12µs | 1 | 1µs | s/ \A - /:/xm for @args;          # spent     1µs making 1 call to Sub::Exporter::Progressive::CORE:subst | 
| 44 | 1 | 1µs | @_ = ($self, @args); | ||
| 45 | 1 | 6µs | 1 | 70µs | goto \&Exporter::import;          # spent    70µs making 1 call to Exporter::import | 
| 46 | } | ||||
| 47 | 2 | 18µs | }; | ||
| 48 | 2 | 9µs | return; | ||
| 49 | } | ||||
| 50 | |||||
| 51 | 1 | 1µs | my $too_complicated = <<'DEATH'; | ||
| 52 | You are using Sub::Exporter::Progressive, but the features your program uses from | ||||
| 53 | Sub::Exporter cannot be implemented without Sub::Exporter, so you might as well | ||||
| 54 | just use vanilla Sub::Exporter | ||||
| 55 | DEATH | ||||
| 56 | |||||
| 57 | # spent 66µs (60+6) within Sub::Exporter::Progressive::sub_export_options which was called 2 times, avg 33µs/call:
# 2 times (60µs+6µs) by Sub::Exporter::Progressive::import at line 17, avg 33µs/call | ||||
| 58 | 2 | 2µs | my ($inner_target, $setup, $options) = @_; | ||
| 59 | |||||
| 60 | 2 | 0s | my @exports; | ||
| 61 | my @defaults; | ||||
| 62 | my %tags; | ||||
| 63 | |||||
| 64 | 2 | 1µs | if ( ($setup||'') eq '-setup') { | ||
| 65 | 2 | 4µs | my %options = %$options; | ||
| 66 | |||||
| 67 | OPTIONS: | ||||
| 68 | 2 | 7µs | for my $opt (keys %options) { | ||
| 69 | 4 | 3µs | if ($opt eq 'exports') { | ||
| 70 | |||||
| 71 | 2 | 2µs | _croak $too_complicated if ref $options{exports} ne 'ARRAY'; | ||
| 72 | 2 | 0s | @exports = @{$options{exports}}; | ||
| 73 | 2 | 1µs | _croak $too_complicated if grep { length ref $_ } @exports; | ||
| 74 | |||||
| 75 | } elsif ($opt eq 'groups') { | ||||
| 76 | 2 | 2µs | %tags = %{$options{groups}}; | ||
| 77 | 2 | 0s | for my $tagset (values %tags) { | ||
| 78 | _croak $too_complicated if grep { | ||||
| 79 | 2 | 9µs | 2 | 2µs | length ref $_                   # spent     2µs making 2 calls to Sub::Exporter::Progressive::CORE:match, avg 1µs/call | 
| 80 | or | ||||
| 81 | $_ =~ / \A - (?! all \b ) /x | ||||
| 82 | 2 | 3µs | } @{$tagset}; | ||
| 83 | } | ||||
| 84 | 2 | 1µs | @defaults = @{$tags{default} || [] }; | ||
| 85 | } else { | ||||
| 86 | _croak $too_complicated; | ||||
| 87 | } | ||||
| 88 | } | ||||
| 89 | 6 | 19µs | 4 | 4µs | @{$_} = map { / \A  [:-] all \z /x ? @exports : $_ } @{$_} for \@defaults, values %tags;       # spent     4µs making 4 calls to Sub::Exporter::Progressive::CORE:match, avg 1µs/call | 
| 90 | 2 | 2µs | $tags{all} ||= [ @exports ]; | ||
| 91 | 2 | 2µs | my %exports = map { $_ => 1 } @exports; | ||
| 92 | 2 | 1µs | my @errors = grep { not $exports{$_} } @defaults; | ||
| 93 | 2 | 2µs | _croak join(', ', @errors) . " is not exported by the $inner_target module\n" if @errors; | ||
| 94 | } | ||||
| 95 | |||||
| 96 | return { | ||||
| 97 | 2 | 26µs | exports => \@exports, | ||
| 98 | defaults => \@defaults, | ||||
| 99 | original => $options, | ||||
| 100 | tags => \%tags, | ||||
| 101 | }; | ||||
| 102 | } | ||||
| 103 | |||||
| 104 | 1 | 3µs | 1; | ||
| 105 | |||||
| 106 | __END__ | ||||
| # spent 14µs within Sub::Exporter::Progressive::CORE:match which was called 8 times, avg 2µs/call:
# 4 times (4µs+0s) by Sub::Exporter::Progressive::sub_export_options at line 89, avg 1µs/call
# 2 times (2µs+0s) by Sub::Exporter::Progressive::sub_export_options at line 79, avg 1µs/call
#    once (7µs+0s) by Sub::Exporter::Progressive::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Sub/Exporter/Progressive.pm:47] at line 30
#    once (1µs+0s) by Sub::Exporter::Progressive::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Sub/Exporter/Progressive.pm:47] at line 39 | |||||
| # spent 1µs within Sub::Exporter::Progressive::CORE:subst which was called:
#    once (1µs+0s) by Sub::Exporter::Progressive::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/Sub/Exporter/Progressive.pm:47] at line 43 |