| Filename | /home/ss5/perl5/perlbrew/perls/perl-5.22.0/lib/site_perl/5.22.0/B/Hooks/EndOfScope.pm |
| Statements | Executed 15 statements in 173µs |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 10µs | 10µs | B::Hooks::EndOfScope::BEGIN@13 |
| 1 | 1 | 1 | 9µs | 52µs | B::Hooks::EndOfScope::BEGIN@23 |
| 1 | 1 | 1 | 8µs | 13µs | B::Hooks::EndOfScope::BEGIN@16 |
| 1 | 1 | 1 | 7µs | 8µs | B::Hooks::EndOfScope::BEGIN@5 |
| 1 | 1 | 1 | 6µs | 1.20ms | B::Hooks::EndOfScope::BEGIN@15 |
| 1 | 1 | 1 | 4µs | 6µs | B::Hooks::EndOfScope::BEGIN@6 |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package B::Hooks::EndOfScope; # git description: 0.14-19-g9296689 | ||||
| 2 | # ABSTRACT: Execute code after a scope finished compilation | ||||
| 3 | # KEYWORDS: code hooks execution scope | ||||
| 4 | |||||
| 5 | 2 | 14µs | 2 | 9µs | # spent 8µs (7+1) within B::Hooks::EndOfScope::BEGIN@5 which was called:
# once (7µs+1µs) by namespace::clean::BEGIN@11 at line 5 # spent 8µs making 1 call to B::Hooks::EndOfScope::BEGIN@5
# spent 1µs making 1 call to strict::import |
| 6 | 2 | 19µs | 2 | 9µs | # spent 6µs (4+2) within B::Hooks::EndOfScope::BEGIN@6 which was called:
# once (4µs+2µs) by namespace::clean::BEGIN@11 at line 6 # spent 6µs making 1 call to B::Hooks::EndOfScope::BEGIN@6
# spent 2µs making 1 call to warnings::import |
| 7 | |||||
| 8 | 1 | 200ns | our $VERSION = '0.15'; | ||
| 9 | |||||
| 10 | # note - a %^H tie() fallback will probably work on 5.6 as well, | ||||
| 11 | # if you need to go that low - sane patches passing *all* tests | ||||
| 12 | # will be gladly accepted | ||||
| 13 | 2 | 33µs | 1 | 10µs | # spent 10µs within B::Hooks::EndOfScope::BEGIN@13 which was called:
# once (10µs+0s) by namespace::clean::BEGIN@11 at line 13 # spent 10µs making 1 call to B::Hooks::EndOfScope::BEGIN@13 |
| 14 | |||||
| 15 | # spent 1.20ms (6µs+1.19) within B::Hooks::EndOfScope::BEGIN@15 which was called:
# once (6µs+1.19ms) by namespace::clean::BEGIN@11 at line 21 | ||||
| 16 | 3 | 31µs | 2 | 17µs | # spent 13µs (8+4) within B::Hooks::EndOfScope::BEGIN@16 which was called:
# once (8µs+4µs) by namespace::clean::BEGIN@11 at line 16 # spent 13µs making 1 call to B::Hooks::EndOfScope::BEGIN@16
# spent 4µs making 1 call to UNIVERSAL::VERSION |
| 17 | 1 | 4µs | 2 | 1.19ms | Module::Implementation::build_loader_sub( # spent 1.17ms making 1 call to Module::Implementation::__ANON__[Module/Implementation.pm:52]
# spent 19µs making 1 call to Module::Implementation::build_loader_sub |
| 18 | implementations => [ 'XS', 'PP' ], | ||||
| 19 | symbols => [ 'on_scope_end' ], | ||||
| 20 | )->(); | ||||
| 21 | 1 | 29µs | 1 | 1.20ms | } # spent 1.20ms making 1 call to B::Hooks::EndOfScope::BEGIN@15 |
| 22 | |||||
| 23 | 1 | 4µs | 1 | 37µs | # spent 52µs (9+43) within B::Hooks::EndOfScope::BEGIN@23 which was called:
# once (9µs+43µs) by namespace::clean::BEGIN@11 at line 26 # spent 37µs making 1 call to Sub::Exporter::Progressive::import |
| 24 | exports => [ 'on_scope_end' ], | ||||
| 25 | groups => { default => ['on_scope_end'] }, | ||||
| 26 | 2 | 38µs | 2 | 58µs | }; # spent 52µs making 1 call to B::Hooks::EndOfScope::BEGIN@23
# spent 6µs making 1 call to UNIVERSAL::VERSION |
| 27 | |||||
| 28 | #pod =head1 SYNOPSIS | ||||
| 29 | #pod | ||||
| 30 | #pod on_scope_end { ... }; | ||||
| 31 | #pod | ||||
| 32 | #pod =head1 DESCRIPTION | ||||
| 33 | #pod | ||||
| 34 | #pod This module allows you to execute code when perl finished compiling the | ||||
| 35 | #pod surrounding scope. | ||||
| 36 | #pod | ||||
| 37 | #pod =func on_scope_end | ||||
| 38 | #pod | ||||
| 39 | #pod on_scope_end { ... }; | ||||
| 40 | #pod | ||||
| 41 | #pod on_scope_end $code; | ||||
| 42 | #pod | ||||
| 43 | #pod Registers C<$code> to be executed after the surrounding scope has been | ||||
| 44 | #pod compiled. | ||||
| 45 | #pod | ||||
| 46 | #pod This is exported by default. See L<Sub::Exporter> on how to customize it. | ||||
| 47 | #pod | ||||
| 48 | #pod =head1 PURE-PERL MODE CAVEAT | ||||
| 49 | #pod | ||||
| 50 | #pod While L<Variable::Magic> has access to some very dark sorcery to make it | ||||
| 51 | #pod possible to throw an exception from within a callback, the pure-perl | ||||
| 52 | #pod implementation does not have access to these hacks. Therefore, what | ||||
| 53 | #pod would have been a compile-time exception is instead converted to a | ||||
| 54 | #pod warning, and your execution will continue as if the exception never | ||||
| 55 | #pod happened. | ||||
| 56 | #pod | ||||
| 57 | #pod To explicitly request an XS (or PP) implementation one has two choices. Either | ||||
| 58 | #pod to import from the desired implementation explicitly: | ||||
| 59 | #pod | ||||
| 60 | #pod use B::Hooks::EndOfScope::XS | ||||
| 61 | #pod or | ||||
| 62 | #pod use B::Hooks::EndOfScope::PP | ||||
| 63 | #pod | ||||
| 64 | #pod or by setting C<$ENV{B_HOOKS_ENDOFSCOPE_IMPLEMENTATION}> to either C<XS> or | ||||
| 65 | #pod C<PP>. | ||||
| 66 | #pod | ||||
| 67 | #pod =head1 SEE ALSO | ||||
| 68 | #pod | ||||
| 69 | #pod L<Sub::Exporter> | ||||
| 70 | #pod | ||||
| 71 | #pod L<Variable::Magic> | ||||
| 72 | #pod | ||||
| 73 | #pod =cut | ||||
| 74 | |||||
| 75 | 1 | 2µs | 1; | ||
| 76 | |||||
| 77 | __END__ |