Filename | /usr/local/share/perl/5.18.2/B/Hooks/EndOfScope.pm |
Statements | Executed 15 statements in 508µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 1.23ms | 5.05ms | BEGIN@16 | B::Hooks::EndOfScope::
1 | 1 | 1 | 20µs | 117µs | BEGIN@23 | B::Hooks::EndOfScope::
1 | 1 | 1 | 14µs | 30µs | BEGIN@5 | B::Hooks::EndOfScope::
1 | 1 | 1 | 14µs | 14µs | BEGIN@13 | B::Hooks::EndOfScope::
1 | 1 | 1 | 13µs | 3.62ms | BEGIN@15 | B::Hooks::EndOfScope::
1 | 1 | 1 | 10µs | 15µs | BEGIN@6 | B::Hooks::EndOfScope::
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 | 43µs | 2 | 46µs | # spent 30µs (14+16) within B::Hooks::EndOfScope::BEGIN@5 which was called:
# once (14µs+16µs) by namespace::autoclean::BEGIN@10 at line 5 # spent 30µs making 1 call to B::Hooks::EndOfScope::BEGIN@5
# spent 16µs making 1 call to strict::import |
6 | 2 | 49µs | 2 | 20µs | # spent 15µs (10+5) within B::Hooks::EndOfScope::BEGIN@6 which was called:
# once (10µs+5µs) by namespace::autoclean::BEGIN@10 at line 6 # spent 15µs making 1 call to B::Hooks::EndOfScope::BEGIN@6
# spent 5µs making 1 call to warnings::import |
7 | |||||
8 | 1 | 700ns | 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 | 71µs | 1 | 14µs | # spent 14µs within B::Hooks::EndOfScope::BEGIN@13 which was called:
# once (14µs+0s) by namespace::autoclean::BEGIN@10 at line 13 # spent 14µs making 1 call to B::Hooks::EndOfScope::BEGIN@13 |
14 | |||||
15 | # spent 3.62ms (13µs+3.61) within B::Hooks::EndOfScope::BEGIN@15 which was called:
# once (13µs+3.61ms) by namespace::autoclean::BEGIN@10 at line 21 | ||||
16 | 3 | 164µs | 2 | 5.06ms | # spent 5.05ms (1.23+3.82) within B::Hooks::EndOfScope::BEGIN@16 which was called:
# once (1.23ms+3.82ms) by namespace::autoclean::BEGIN@10 at line 16 # spent 5.05ms making 1 call to B::Hooks::EndOfScope::BEGIN@16
# spent 13µs making 1 call to UNIVERSAL::VERSION |
17 | 1 | 7µs | 2 | 3.61ms | Module::Implementation::build_loader_sub( # spent 3.57ms making 1 call to Module::Implementation::__ANON__[Module/Implementation.pm:52]
# spent 36µs making 1 call to Module::Implementation::build_loader_sub |
18 | implementations => [ 'XS', 'PP' ], | ||||
19 | symbols => [ 'on_scope_end' ], | ||||
20 | )->(); | ||||
21 | 1 | 75µs | 1 | 3.62ms | } # spent 3.62ms making 1 call to B::Hooks::EndOfScope::BEGIN@15 |
22 | |||||
23 | 1 | 8µs | 1 | 84µs | # spent 117µs (20+97) within B::Hooks::EndOfScope::BEGIN@23 which was called:
# once (20µs+97µs) by namespace::autoclean::BEGIN@10 at line 26 # spent 84µs making 1 call to Sub::Exporter::Progressive::import |
24 | exports => [ 'on_scope_end' ], | ||||
25 | groups => { default => ['on_scope_end'] }, | ||||
26 | 2 | 80µs | 2 | 130µs | }; # spent 117µs making 1 call to B::Hooks::EndOfScope::BEGIN@23
# spent 13µ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 | 9µs | 1; | ||
76 | |||||
77 | __END__ |