File | /usr/local/lib/perl5/site_perl/5.10.1/B/Hooks/EndOfScope.pm |
Statements Executed | 51 |
Statement Execution Time | 519µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 547µs | 993µs | BEGIN@7 | B::Hooks::EndOfScope::
1 | 1 | 1 | 48µs | 48µs | BEGIN@6 | B::Hooks::EndOfScope::
4 | 1 | 1 | 40µs | 73µs | on_scope_end | B::Hooks::EndOfScope::
4 | 4 | 4 | 31µs | 3.04ms | __ANON__[:47] | B::Hooks::EndOfScope::
1 | 1 | 1 | 21µs | 23µs | BEGIN@1 | namespace::clean::
1 | 1 | 1 | 11µs | 384µs | BEGIN@11 | B::Hooks::EndOfScope::
1 | 1 | 1 | 8µs | 16µs | BEGIN@2 | namespace::clean::
4 | 1 | 1 | 6µs | 6µs | __ANON__[:46] | B::Hooks::EndOfScope::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | 3 | 21µs | 2 | 26µs | # spent 23µs (21+3) within namespace::clean::BEGIN@1 which was called
# once (21µs+3µs) by namespace::clean::BEGIN@14 at line 1 # spent 23µs making 1 call to namespace::clean::BEGIN@1
# spent 3µs making 1 call to strict::import |
2 | 3 | 29µs | 2 | 25µs | # spent 16µs (8+9) within namespace::clean::BEGIN@2 which was called
# once (8µs+9µs) by namespace::clean::BEGIN@14 at line 2 # spent 16µs making 1 call to namespace::clean::BEGIN@2
# spent 9µs making 1 call to warnings::import |
3 | |||||
4 | package B::Hooks::EndOfScope; | ||||
5 | |||||
6 | 3 | 66µs | 1 | 48µs | # spent 48µs within B::Hooks::EndOfScope::BEGIN@6 which was called
# once (48µs+0s) by namespace::clean::BEGIN@14 at line 6 # spent 48µs making 1 call to B::Hooks::EndOfScope::BEGIN@6 |
7 | 3 | 127µs | 2 | 1.01ms | # spent 993µs (547+445) within B::Hooks::EndOfScope::BEGIN@7 which was called
# once (547µs+445µs) by namespace::clean::BEGIN@14 at line 7 # spent 993µs making 1 call to B::Hooks::EndOfScope::BEGIN@7
# spent 18µs making 1 call to Exporter::import |
8 | |||||
9 | 1 | 700ns | our $VERSION = '0.08'; | ||
10 | |||||
11 | 1 | 7µs | 1 | 373µs | # spent 384µs (11+373) within B::Hooks::EndOfScope::BEGIN@11 which was called
# once (11µs+373µs) by namespace::clean::BEGIN@14 at line 14 # spent 373µs making 1 call to Sub::Exporter::__ANON__[Sub/Exporter.pm:756] |
12 | exports => ['on_scope_end'], | ||||
13 | groups => { default => ['on_scope_end'] }, | ||||
14 | 2 | 157µs | 1 | 384µs | }; # spent 384µs making 1 call to B::Hooks::EndOfScope::BEGIN@11 |
15 | |||||
16 | =head1 NAME | ||||
17 | |||||
18 | B::Hooks::EndOfScope - Execute code after a scope finished compilation | ||||
19 | |||||
20 | =head1 SYNOPSIS | ||||
21 | |||||
22 | on_scope_end { ... }; | ||||
23 | |||||
24 | =head1 DESCRIPTION | ||||
25 | |||||
26 | This module allows you to execute code when perl finished compiling the | ||||
27 | surrounding scope. | ||||
28 | |||||
29 | =head1 FUNCTIONS | ||||
30 | |||||
31 | =head2 on_scope_end | ||||
32 | |||||
33 | on_scope_end { ... }; | ||||
34 | |||||
35 | on_scope_end $code; | ||||
36 | |||||
37 | Registers C<$code> to be executed after the surrounding scope has been | ||||
38 | compiled. | ||||
39 | |||||
40 | This is exported by default. See L<Sub::Exporter> on how to customize it. | ||||
41 | |||||
42 | =cut | ||||
43 | |||||
44 | { | ||||
45 | 1 | 400ns | my $wiz = Variable::Magic::wizard | ||
46 | 4 | 11µs | # spent 6µs within B::Hooks::EndOfScope::__ANON__[/usr/local/lib/perl5/site_perl/5.10.1/B/Hooks/EndOfScope.pm:46] which was called 4 times, avg 2µs/call:
# 4 times (6µs+0s) by Variable::Magic::cast at line 58, avg 2µs/call | ||
47 | 13 | 33µs | 5 | 3.05ms | # spent 3.04ms (31µs+3.01) within B::Hooks::EndOfScope::__ANON__[/usr/local/lib/perl5/site_perl/5.10.1/B/Hooks/EndOfScope.pm:47] which was called 4 times, avg 761µs/call:
# once (8µs+1.95ms) by MooseX::Types::BEGIN@12 at line 290 of MooseX/Types/Base.pm
# once (8µs+614µs) by SimpleDB::Class::Types::BEGIN@77 at line 609 of MooseX/Types.pm
# once (8µs+359µs) by SimpleDB::Class::Types::BEGIN@83 at line 83 of MooseX/Types/Moose.pm
# once (7µs+86µs) by MooseX::Types::BEGIN@15 at line 101 of MooseX/Types/CheckedUtilExports.pm # spent 3.01ms making 4 calls to namespace::clean::__ANON__[namespace/clean.pm:275], avg 753µs/call
# spent 38µs making 1 call to Variable::Magic::wizard |
48 | |||||
49 | # spent 73µs (40+33) within B::Hooks::EndOfScope::on_scope_end which was called 4 times, avg 18µs/call:
# 4 times (40µs+33µs) by namespace::clean::import at line 275 of namespace/clean.pm, avg 18µs/call | ||||
50 | 4 | 2µs | my $cb = shift; | ||
51 | |||||
52 | 4 | 4µs | $^H |= 0x020000; | ||
53 | |||||
54 | 4 | 26µs | 4 | 4µs | if (my $stack = Variable::Magic::getdata %^H, $wiz) { # spent 4µs making 4 calls to Variable::Magic::getdata, avg 900ns/call |
55 | push @{ $stack }, $cb; | ||||
56 | } | ||||
57 | else { | ||||
58 | 4 | 28µs | 8 | 36µs | Variable::Magic::cast %^H, $wiz, $cb; # spent 29µs making 4 calls to Variable::Magic::cast, avg 7µs/call
# spent 6µs making 4 calls to B::Hooks::EndOfScope::__ANON__[B/Hooks/EndOfScope.pm:46], avg 2µs/call |
59 | } | ||||
60 | } | ||||
61 | } | ||||
62 | |||||
63 | =head1 SEE ALSO | ||||
64 | |||||
65 | L<Sub::Exporter> | ||||
66 | |||||
67 | L<Variable::Magic> | ||||
68 | |||||
69 | =head1 AUTHOR | ||||
70 | |||||
71 | Florian Ragwitz E<lt>rafl@debian.orgE<gt> | ||||
72 | |||||
73 | =head1 COPYRIGHT AND LICENSE | ||||
74 | |||||
75 | Copyright (c) 2008 Florian Ragwitz | ||||
76 | |||||
77 | This module is free software. | ||||
78 | |||||
79 | You may distribute this code under the same terms as Perl itself. | ||||
80 | |||||
81 | =cut | ||||
82 | |||||
83 | 1 | 7µs | 1; |